Grails - 将日期字段与今天进行比较时的HQL异常

时间:2014-09-10 14:09:32

标签: grails hql grails-2.0

我有以下HQL查询,我正在对H2数据库运行:

"select count(*) from Event as e where " +
   "e.org.id = :orgId and " +
   "e.deleted = :deleted and " +
   "e.startDate >= :startDate and " +
   "lower(e.name) like :name " +
   "order by startDate asc"

除了今天的那些之外,它适用于所有startDate参数。如果startDate是今天,我会得到以下异常:

org.springframework.jdbc.UncategorizedSQLException: Hibernate operation: 

could not execute query; uncategorized SQLException for SQL 
[select count(*) as col_0_0_ from event event0_ where event0_.org_id=? and 
event0_.deleted=? and event0_.start_date>=? and 
(lower(event0_.event_name) like ?) order by event0_.start_date asc]; 

SQL state [90016]; error code [90016]; 
Column "EVENT0_.START_DATE" must be in the GROUP BY list; SQL statement:

有人有任何建议吗?

0 个答案:

没有答案