-->
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.  [ 1 post ] 
Author Message
 Post subject: How to write HQL query for the SQL query without IN Clause
PostPosted: Mon Jan 09, 2012 4:46 pm 
Newbie

Joined: Mon Jan 09, 2012 4:34 pm
Posts: 1
How do i convert the below SQL query into HQL query without using IN

select a.*,b.*,c.* from table1 a,table2 b,table3 c,(select max(id) as id from table1 group by id1,id2) as d
where d.col1=a.col1
and b.col1=a.col2
and c.col1=a.col3
and a.col4=?
and a.datecolumn between ? and ?
order by a.datecolumn desc

I have tried the same with the NativeSQL (createSQLQuery), the problem i faced there is it is executing so many sub queries which i don't want to happen.

Please suggest me a solution to over come this problem

Please let me know for any further questions.

Thanks,
Shan.....


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

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.