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;
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;