zoukankan      html  css  js  c++  java
  • 删除重复数据,保留一条ID最小的

    SELECT * from TBCITY_Temp
    where code 
     in (
      select
       code
        from TBCITY_Temp
       group by code
      having count(code) > 1
      )
    and   AutoId not in (
          select min(AutoId)
            from TBCITY_Temp
           group by code    
          having count(code)>1)

    -- 条件为code再重复数据里,and Id 不是最小的

  • 相关阅读:
    iOS
    iOS
    iOS
    iOS
    iOS
    iOS
    iOS
    iOS
    iOS
    iOS
  • 原文地址:https://www.cnblogs.com/chengeng/p/4446921.html
Copyright © 2011-2022 走看看