drop table test4


SELECT * INTO test4 from
(
select len(isnull(姓名,0)+isnull(性别,0)+isnull(年龄,0)+isnull(级别,0)+isnull(职务,0)+isnull(行业,0)+isnull([国家/省份],0)+isnull(城市,0)+isnull(企业名称,0)+isnull(电话,0)+isnull(手机,0)+isnull(EMail,0)) as t,ROW_NUMBER() OVER(ORDER BY len(isnull(姓名,0)+isnull(性别,0)+isnull(年龄,0)+isnull(级别,0)+isnull(职务,0)+isnull(行业,0)+isnull([国家/省份],0)+isnull(城市,0)+isnull(企业名称,0)+isnull(电话,0)+isnull(手机,0)+isnull(EMail,0)) DESC) AS 'ID'
,* from Test
where 姓名 IS NOT NULL AND 手机 IS NOT NULL and email IS NOT NULL
) as  tt

 

delete   test4
where   id   not   in
(
select   min(id)   from   test4  
group   by   姓名,手机,EMail)

 

WITH   b AS ( SELECT   ROW_NUMBER() OVER ( PARTITION BY 姓名,手机,email ORDER BY id asc ) AS rn,
                        *
               FROM     test4
             )
    DELETE  FROM b
    WHERE   rn > 1

 

Delete T From
(Select Row_Number() Over(Partition By 姓名,手机,email order By id asc) As RowNumber,* From test4) T
Where T.RowNumber > 1

 

SELECT 姓名,手机,email,count(*) from test4
GROUP BY 姓名,手机,email
HAVING count(*)>1

相关文章:

  • 2021-06-28
  • 2022-12-23
  • 2021-11-14
  • 2021-12-10
  • 2021-12-27
  • 2021-12-16
  • 2022-12-23
猜你喜欢
  • 2021-11-14
  • 2021-12-14
  • 2022-12-23
  • 2021-11-14
  • 2021-11-24
  • 2021-09-12
相关资源
相似解决方案