tags:

views:

98

answers:

1

Im running into some problems when trying to convert a SQL query into HQL (or Criteria/Restriction). I have the following SQL query:

Select count(n), CreatedDate from (
  Select count(serverId) as n, Date(Created) as CreatedDate 
  from mytable 
  group by Date(Created), serverId
) as tbl 
group by CreatedDate;

So what is the HQL (or Criteria) equivalent?

+2  A: 

Some SQL queries cannot be directly translated to HSQL but this might help: http://stackoverflow.com/questions/1141777/hsql-subqueries

Maurice Perry