[SQL] 查询指定Account的数据记录数不超过20条

select AccountId,COUNT(*) as cnt from tablename 
group by AccountId
having COUNT(*)<20

having 后面只能用 COUNT(*),不能用 cnt

posted @ 2017-07-25 10:31  Sunshine168  阅读(363)  评论(0编辑  收藏  举报