-->
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: Any HQL wizards want to help?
PostPosted: Sat Aug 01, 2009 6:39 pm 
Newbie

Joined: Tue Jul 14, 2009 2:16 pm
Posts: 6
I would like to translate this SQL query:
Code:
select f.type, f.variety, f.price
from (
   select type, min(price) as minprice
   from fruits group by type
) as x inner join fruits as f on f.type = x.type and f.price = x.minprice;


into HQL. The main idea is to get the the fruit of lowest price from each group. The groups are like apples, bananas, oranges, etc... and there are multiple types in each group like Fuji, Pink Lady, etc...

Any help would be appreciated. If I should just give up and do it in native SQL, that would be alright, but I'd rather avoid it.


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.