SQLS删除重复记录

来源:互联网 发布:人工智能7大应用领域 编辑:程序博客网 时间:2024/05/22 05:27

select COUNT(fid)-count(distinct FMobile) from t_company

delete from t_company where exists (
select * from t_company as b
where b.FName = t_company.FName
and b.Fid < t_company.Fid
)


delete from t_company where exists (
select * from t_company as b
where b.FHttp = t_company.FHttp
and b.Fid < t_company.Fid
)

delete from t_company where exists (
select * from t_company as b
where b.FTel = t_company.FTel
and b.Fid < t_company.Fid
)

delete from t_company where exists (
select * from t_company as b
where b.FMobile = t_company.FMobile
and b.Fid < t_company.Fid
)

delete from t_company where exists (
select * from t_company as b
where b.FFax = t_company.FFax
and b.Fid < t_company.Fid
)

原创粉丝点击