只需在count中加入distinct '指定列'就可以在计算行数时去掉指定列中重复的值
例子:
select title,count(distinct emp_no) t
from titles
group by title having count(*)>=2
在count函数计数时去掉重复的emp_no