0
点赞
收藏
分享

微信扫一扫

hql的count()函数问题


hql 语句  :   select count(q) from Question q inner join fetch q.account a inner join fetch q.category c where a.id='202647' and q.startTime between to_date('2004-4-4','yyyy-mm-dd') and to_date('2005-7-7','yyyy-mm-dd')

这个语句中主对象Question q  抓取了 q.account和q.category,我只是想统计主对象Question q的数量。Exception :   java.sql.SQLException: ORA-00937: 非单组分组函数(奇怪的是查看console中输出的sql语句,它不光把count(q)列了出来,而且把q.account和q.category的每个字段都列了出来)。不知道怎么解决???????????

解答:

fetch 去掉

举报

相关推荐

0 条评论