anon
anon

Reputation:

Hibernate SQL to HQL

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?

Upvotes: 2

Views: 389

Answers (1)

Maurice Perry
Maurice Perry

Reputation: 32841

Some SQL queries cannot be directly translated to HSQL but this might help: HQL Subqueries in joins

Upvotes: 3

Related Questions