MYSQL写法:
select count(*) from (select count(*) from s_role group by status) a
我在hql写法:
select count(*) from (select count(*) from Role as r group by u.status) as c
可是hibernate不认这么写的,请问该如何去写呢,谢谢高人
MYSQL写法:
select count(*) from (select count(*) from s_role group by status) a
我在hql写法:
select count(*) from (select count(*) from Role as r group by u.status) as c
可是hibernate不认这么写的,请问该如何去写呢,谢谢高人
[code="java"]
// hql
String hql = "SELECT COUNT(*) FROM Role p WHERE p.role主键 IN (SELECT MIN(t.role主键) FROM Role t GROUP BY t.status)";
// 应该和sql select count(*) from (select count(*) from s_role group by status) a 实现的功能是一样的
[/code]