首页 > hibernate 分组查询 count(distinct a, b)

hibernate 分组查询 count(distinct a, b)

hql语句:

select mag.mag_id,
       count(distinct record.magId, record.articleId, record.screenNum)
from Magazine mag, 
     ArticleTemplateRecord record 
where mag.mag_id=record.magId and 
      mag.brand_id=656 
group by mag.mag_id

报错:
org.hibernate.hql.ast.QuerySyntaxException: expecting CLOSE, found ',' near line 1, column 46

也就是说,distinct record.magId后不希望出现','
请问这用hql该怎么写,别说用sql处理,谢谢!


from 后面可以同时写两个表么?

【热门文章】
【热门文章】