时间:2021-07-01 10:21:17 帮助过:28人阅读
下面的例子中可以根据一个或者多个fieldfield来判断是否为重复记录。假设某表employees有如下三列:pk, id, email
下面的例子中可以根据一个或者多个fieldfield来判断是否为重复记录。
假设某表employees有如下三列:
pk, id, email
根据id字段来判断重复
select * from employees where id in (select id from employees group by id having count(id) > 1);
根据id和email字段来判断重复
select * from employees e where (e.id, e.email) in (select id, email from employees group by id, email having count(*) > 1);
,