In the end, this is the SQL I'm looking for, which functions correctly:
Code:
select member.clubId, count(member.id) as counter from ClubMember member group by member.clubId order by counter desc limit 5
The following HQL works correctly, but does not have an order by clause:
Code:
select members.club, count(members) from ClubMember members group by members.club limit 5
Most queries I attempt give the ", expected" error. The following queries give a different result.
Code:
select members.club, count(members) from ClubMember members group by members.club order by count(members) desc limit 5
Error is:
Code:
java.sql.SQLException: Invalid use of group function