zoukankan      html  css  js  c++  java
  • 删除语句

    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

  • 相关阅读:
    c读取文本文档
    java类中定义接口
    android selector
    android listview
    android继承Dialog实现自定义对话框
    移植net-snmp到开发板(mini210)
    [BZOJ1901]Zju2112 Dynamic Rankings
    [BZOJ3524][Poi2014]Couriers
    [codeforces722D]Generating Sets
    [codeforces722C]Destroying Array
  • 原文地址:https://www.cnblogs.com/zwei1121/p/2617998.html
Copyright © 2011-2022 走看看