How to retrieve the ordered list of best articles having a minimum number of votes by using HSQL ?
Posted
by fabien7474
on Stack Overflow
See other posts from Stack Overflow
or by fabien7474
Published on 2010-06-06T22:09:42Z
Indexed on
2010/06/06
22:12 UTC
Read the original article
Hit count: 330
I have a Vote domain class from my grails application containing properties like article_id and note
I want to HQL query the Vote domain class in order to retrieve the 5 best rated articles having at least 10 votes.
I tried :
SELECT v.article_id, avg(v.note), count(*) FROM vote v where count(*) >= 10 group by v.article_id order by avg(v.note) desc limit 5;
But unfortunately the insertion of where count(*) >= 10 throws an error.
How can I do that in a simple way?
Thank you for your help.
© Stack Overflow or respective owner