select*from ( --获取冗余数据中的唯一最小行数据 select*from table_1 t1 where t1.id in ( selectmin(t2.id) from table_1 t2 groupby t2.employeeid having t1.employeeid=t2.employeeid andcount(*) >1 ) unionall --获取非冗余数据 select*from table_1 t4 where t4.id in ( selectmin(t3.id) from table_1 t3 groupby t3.employeeid having t4.employeeid = t3.employeeid andcount(*) =1 ) ) t5 orderby id