1、查找表中的多余的重复记录,重复记录是根据单个字段(empID)来判断
select * from Employee where EmpID in (select EmpID from Employee group by EmpID having count(EmpID)>1 )
2、删除表中多余的重复记录,重复记录是根据单个字段(empID)来判断,,
select * from Employee where EmpID in (select EmpID from Employee group by EmpID having count(EmpID)>1 )
多字段:
1、选择:
select * from vitae emp where (emp.empID,emp.seq) in (select empID,seq from vitae group by empID ,seq having count(*) >1)
2、删除
delete from employee where empName in(select empName from employee group by empName having count(empName)>1) and empID not in (select min(empID) from employee group by empName having count(empName)>1 )