zoukankan      html  css  js  c++  java
  • sql语句删除数据表重复字段的方法

    大家都可能遇到字段重复的情况,网上很多人在找方法,也给出了一些方法,但是有的方法是误导大家,铁牛写出以下方法,方便大家使用

      1.通过group by把重复的字段筛选出来,并建立临时表tmp

    1
    create table tmp as select max(id) as col1 from www group by dfdfd;

      2.从去重表对象里通过not in的条件来筛选出不在临时表的列col1,执行not in的删除操作

    1
    delete from www where id not in (select col1 from tmp);

      3.删除临时表

      1
    drop table tmp;
  • 相关阅读:
    64最长和谐子序列(594)
    63找到字符串中所有字母异位词(438)
    62有效的数独(36)
    10.10
    9.27作业
    9.27
    9.26
    9.25
    9.18学习内容
    9.17作业
  • 原文地址:https://www.cnblogs.com/xlz307/p/4315778.html
Copyright © 2011-2022 走看看