从titles表获取按照title进行分组

从titles表获取按照title进行分组,注意对于重复的emp_no进行忽略。

http://www.nowcoder.com/questionTerminal/c59b452f420c47f48d9c86d69efdff20

select title , count() t
from (
select distinct emp_no , title from titles
)
group by title
having t>= 2;
/
distinct不要写错了
更简单些
select title , count(distinct emp_no ) t
from titles
group by title
having t>= 2;

全部评论

相关推荐

评论
点赞
收藏
分享

创作者周榜

更多
牛客网
牛客网在线编程
牛客网题解
牛客企业服务