-->
These old forums are deprecated now and set to read-only. We are waiting for you on our new forums!
More modern, Discourse-based and with GitHub/Google/Twitter authentication built-in.

All times are UTC - 5 hours [ DST ]



Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 2 posts ] 
Author Message
 Post subject: Query in XML file
PostPosted: Thu Jul 13, 2006 5:30 am 
Newbie

Joined: Tue May 09, 2006 4:22 am
Posts: 2
Hello,
I have two SQL queries in my xml file, each query works fine. But I want to know if it's possible to get the same résult with only one query.
SQL queries are (the argument is the same for the two queries):

<query name="findTextFiedlValueContactByEmail">
<![CDATA[select count(tfv) from TextFieldValue tfv join tfv.m_field field where field.class='MailField' and tfv.m_value=?]]>
</query>

<query name="isEmailInWhiteList">
<![CDATA[select count(*) from EmailAccount ea where ea.m_email=?]]>
</query>


I want to do something like that :

<query name="findTextFiedlValueContactByEmail">
<![CDATA[select count(tfv) from TextFieldValue tfv join tfv.m_field field where field.class='MailField' and tfv.m_value=?]]>
<![CDATA[select count(*) from EmailAccount ea where ea.m_email=?]]>
</query>


Is it possible ?


Top
 Profile  
 
 Post subject:
PostPosted: Fri Jul 14, 2006 1:08 am 
Expert
Expert

Joined: Thu Dec 23, 2004 9:08 pm
Posts: 2008
Sure, but not on a single row, because of theta-style join rules (try it: you'll get two columns where both have the same value, being the product of the two values you want). You can union the two queries, to get the results on separate rows. Then just iterate over the two rows that are returned, and get the two counts out.

_________________
Code tags are your friend. Know them and use them.


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 2 posts ] 

All times are UTC - 5 hours [ DST ]


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
© Copyright 2014, Red Hat Inc. All rights reserved. JBoss and Hibernate are registered trademarks and servicemarks of Red Hat, Inc.