标签: sql oracle10g
此sql返回在数据库中具有多个角色的actor但是如何修改它以便它只返回具有三个以上角色的actor的数量?例如,只返回数字3。
SELECT ACTORID FROM ROLE GROUP BY actorID HAVING COUNT(*) > 3;
答案 0 :(得分:6)
试试这个
SELECT count(1) from (SELECT ACTORID FROM ROLE GROUP BY actorID HAVING COUNT(*) > 3)