Oracle_分组查询_group_by

sql

group_by_having

select code,count(sexType) as counts from t_class where sexType= 2  
group by code having count(sexType)>2

select temp.code,temp.counts
FROM
(
select code,count(sexType) as counts from t_class where sexType= 2  group by code
)temp  
where temp.counts>2
发布了279 篇原创文章 · 获赞 113 · 访问量 78万+

猜你喜欢

转载自blog.csdn.net/icecoola_/article/details/95047295