Hi all,
actually I am not able to transfer this MySQL statement to an HQL statement
Code:
SELECT count(*) / count(distinct month(c.created_date_time),year(c.created_date_time)) as averg
FROM comments c
My HQL lines are:
Code:
String hql = "select count(*) / count(distinct month(c.createdDateTime)) as avrg from Comment c";
Float averageBlogsPerYear = (Float) getSession().createQuery(hql).uniqueResult();
If I run it, Hibernate throws this exception:
Code:
org.hibernate.hql.ast.QuerySyntaxException: expecting CLOSE, found '(' near line 1, column 39 [select count(*) / count(distinct month(c.createdDateTime)) as avrg from Comment c
Actually I am lost a bit. Would appreciate any help on this.
Thanks in advance
John