Hql語句中使用group by having中注意

String hql = "SELECT openId FROM ReadLog where createTime > :startTime group by openId having count(1)>:count"; 

以上語句報錯,原因是hql不允許使用count(1)

正解:

String hql = "SELECT openId FROM ReadLog where createTime > :startTime group by openId having count(openId)>:count";

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章