Warning: file_get_contents(/data/phpspider/zhask/data//catemap/5/sql/87.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Sql 如何删除重复数据_Sql_Duplicate Removal - Fatal编程技术网

Sql 如何删除重复数据

Sql 如何删除重复数据,sql,duplicate-removal,Sql,Duplicate Removal,如何删除重复数据?数据格式如下 Id name firstname time age 13014495 abc def 40:44.3 25 13022149 abc def 40:44.3 25 如果您正在使用Oracle,请尝试以下操作: Delete from Your_Table Where ROWID not in (Select min(ROWID)

如何删除重复数据?数据格式如下

Id          name    firstname   time      age
13014495    abc     def         40:44.3   25
13022149    abc     def         40:44.3   25

如果您正在使用Oracle,请尝试以下操作:

    Delete from Your_Table
    Where 
    ROWID not in (Select min(ROWID) 
           from Your_Table               
           group by name, firstname ,time ,age         
           );

为了清楚起见,这将删除name和firstname列相等的最小id。您好,这是仅在两列组合上删除重复行,如果您想要更多行而不是在条件中添加更多行…并且一旦我们了解RDBMS,我们也可以作为重复问题结束。
    Delete from Your_Table
    Where 
    ROWID not in (Select min(ROWID) 
           from Your_Table               
           group by name, firstname ,time ,age         
           );
delete from table 
where rowid > (SELECT min(rowid) 
               FROM table t2 
               group by t2.id,t2.name,t2.firstname,t2.time,t2.age);