Select count(*) as c from casting where ord = 1 Group by actorid Order by count(*) DESC
结果是
15 15 14 13 12 10 7 7 7 7 5 5
然后我想得到的结果只有大于10 ??感谢~~
答案 0 :(得分:3)
SELECT count(*) AS c
FROM casting
WHERE ord = 1
GROUP BY actorid
HAVING c > 10
ORDER BY c DESC
您可以考虑HAVING
WHERE
聚合的GROUP BY
子句。
答案 1 :(得分:2)
SELECT COUNT(*) AS c FROM casting WHERE ord = 1 GROUP BY actorid HAVING COUNT(*) > 10 ORDER BY COUNT(*) DESC
答案 2 :(得分:1)
HAVING c > 10
将其放在group by和
之间