通过什么去判断是异常的数据?如果是你人工判断的话那就没辙了
select * from tab a left join (select 工号,count(姓名) as a from tab group by 工号 having a=1) b on a.工号=b.工号
union all
select * from tab a left join (select 工号,count(姓名) as a from tab group by 工号 having a>1) b on a.工号=b.工号
where a.姓名 not in (select 姓名 from tab a left join (select 工号,count(姓名) as a from tab group by 工号 having a=1) b on a.工号=b.工号)