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.