【发布时间】:2014-03-05 20:48:15
【问题描述】:
我正在尝试使用以下方法获取 s.eventTime 的日期月份和年份:
DAY(s.eventTime) as theDay, MONTH(s.eventTime) as theMonth, YEAR(s.eventTime) as theYear
然后我用GROUP BY theYear, theMonth, theDay
这给了我错误:org.hibernate.exception.SQLGrammarException: Unknown column 'theYear' in 'group statement'
我之前在 SQL 中使用过这种方法,想知道在 HQL 中是否无效?如果是这样,有人有什么建议吗?
【问题讨论】: