Query to delete duplicate records

2010-03-16  来源:本站原创  分类:Database  人气:233 

select t. *, t.rowid from test_select_delete_dump_rd t;
Query to delete duplicate records

- Query the table all the records there are duplicate records
select t. *, t.rowid from test_select_delete_dump_rd t
where
name in (
select name from test_select_delete_dump_rd
group by name
having count (name)> 1
);
Query to delete duplicate records

- Query the table there are duplicate records of redundant records
- Rowid of the record is considered the minimum record keeping
select * from (
select t. *, t.rowid from test_select_delete_dump_rd t
where
name in (
select name from test_select_delete_dump_rd
group by name
having count (name)> 1
)
) T2
where
t2.rowid not in (
select min (t1.rowid) from test_select_delete_dump_rd t1
group by name
having count (name)> 1
);
Query to delete duplicate records

- Query the table there are duplicate records of redundant records
- Rowid is considered the largest record record-keeping
select * from (
select t. *, t.rowid from test_select_delete_dump_rd t
where
name in (
select name from test_select_delete_dump_rd
group by name
having count (name)> 1
)
) T2
where
t2.rowid not in (
select max (t1.rowid) from test_select_delete_dump_rd t1
group by name
having count (name)> 1
);
Query to delete duplicate records

/ **
delete from test_select_delete_dump_rd
where
name in (
select name from test_select_delete_dump_rd
group by name
having count (name)> 1
)
and
rowid not in (
select min (name) from test_select_delete_dump_rd
group by name
having count (name)> 1
);
* /

相关文章
  • Oracle query and delete duplicate records in SQL statement collection 2010-03-25

    Oracle query and delete duplicate records in SQL statement collection ORACLE query and delete duplicate data, we often encounter problems and need treatment, although often useful in that way a lot. But do not want to sort out, so reposted elsewhere

  • MySQL query to delete duplicate records and the method 2011-02-15

    MySQL query to delete duplicate records and the method Query, and delete duplicate records method (A) 1, the lookup table in excess of duplicate records, duplicate records are based on a single field (peopleId) to determine select * from people where

  • Query and delete duplicate records SQL statements (change) 2010-04-02

    Inquiries and the SQL statement to delete duplicate records 1, find the table in excess of duplicate records, duplicate records are based on a single field (peopleId) to determine select * from people where peopleId in (select peopleId from people gr

  • Oracle query and delete duplicate records in SQL statements 2010-05-04

    Inquiries and the SQL statement to delete duplicate records 1, find the table in excess of duplicate records, duplicate records are based on a single field (peopleId) to determine select * from people where peopleId in (select peopleId from people gr

  • MySQL query to delete duplicate records and the methods 2011-05-17

    Inquiries and the method to delete duplicate records (A) 1, the lookup table in the extra duplicate records, duplicate records are based on a single field (peopleId) to determine select * from people where peopleId in (select peopleId from people gro

  • sql server query, and delete duplicate records method 2010-12-22

    First, according to the duplication of a single field 1, the lookup table in excess of duplicate records, duplicate records are based on a single field (peopleId) to determine select * from people where peopleId in (select peopleId from people group

  • Query to delete duplicate records 2010-03-16

    select t. *, t.rowid from test_select_delete_dump_rd t; - Query the table all the records there are duplicate records select t. *, t.rowid from test_select_delete_dump_rd t where name in ( select name from test_select_delete_dump_rd group by name hav

  • SQL query to delete duplicate records 2010-03-26

    1, find the table in excess of duplicate records, duplicate records are based on a single field (peopleId) to determine select * from people where peopleId in (select peopleId from people group by peopleId having count peopleId)> 1) Example Two: sele

  • Query and delete duplicate records method 2010-07-15

    (1) 1, find the table in excess of duplicate records, duplicate records are based on a single field (peopleId) to determine select * from people ­ where peopleId in (select peopleId from people group by peopleId having count(peopleId) > 1) ­ 2, delet

  • ORACLE query, and delete duplicate records method 2010-11-09

    (A) 1, the lookup table in excess of duplicate records, duplicate records are based on a single field (peopleId) to determine select * from people where peopleId in (select peopleId from people group by peopleId having count (peopleId)> 1) 2, delete

  • Query, and delete duplicate records method (a) 1. Lookup table in excess of duplicate records, duplicate records are based on a single field (peopleId) to determine the select * from people whe 2011-02-15

    A multi-valued query MYSQL stored procedure DELIMITER $ $ DROP PROCEDURE IF EXISTS `ipy`. `Sp_pers_srch` $ $ CREATE DEFINER = `root` @ `localhost` PROCEDURE `sp_pers_srch` (IN comp_id int (15), IN var_emplid varchar (15), IN var_first_name varchar (3

  • sql delete duplicate records 2010-04-07

    For example: id name value 1 a pp 2 a pp 3 b iii 4 b pp 5 b pp 6 c pp 7 c pp 8 c iii id is the primary key requirements are the result of this id name value 1 a pp 3 b iii 4 b pp 6 c pp 8 c iii Method 1 delete YourTable where [id] not in ( select max

  • Several SQL statements to delete duplicate records 2010-04-27

    Example, officers now have a table (table name: peosons) If you want the name, ID number, address these three fields exactly the same record check out select p1 .* from persons p1, persons p2 where p1.id <> p2.id and p1.cardid = p2.cardid and p1.pna

  • Query and delete duplicate data table 2010-08-06

    If you want the name, ID number, address these three fields exactly the same record check out select p1 .* from persons p1, persons p2 where p1.id <> p2.id and p1.cardid = p2.cardid and p1.pname = p2.pname and p1.address = p2.address Can achieve the

  • Delete duplicate records using SQL methods N 2010-12-03

    For example: id name value 1 a pp 2 a pp 3 b iii 4 b pp 5 b pp 6 c pp 7 c pp 8 c iii id is the primary key requirements are the result of this id name value 1 a pp 3 b iii 4 b pp 6 c pp 8 c iii Method 1 delete YourTable where [id] not in ( select max

  • sql statement to delete duplicate records method 2011-07-29

    For example: id name value 1 a pp 2 a pp 3 b iii 4 b pp 5 b pp 6 c pp 7 c pp 8 c iii id is the primary key requirement to get this result id name value 1 a pp 3 b iii 4 b pp 6 c pp 8 c iii Method 1 delete YourTable where [id] not in ( select max([id]

  • Delete duplicate records using SQL methods of N 2010-12-03

    For example: id name value 1 a pp 2 a pp 3 b iii 4 b pp 5 b pp 6 c pp 7 c pp 8 c iii id is the primary key requirement to get this result id name value 1 a pp 3 b iii 4 b pp 6 c pp 8 c iii Method 1 delete YourTable where [id] not in ( select max ([id

  • Delete duplicate records using SQL methods of N (rpm) 2011-02-27

    For example: id name value 1 a pp 2 a pp 3 b iii 4 b pp 5 b pp 6 c pp 7 c pp 8 c iii id is the primary key requirement to get this result id name value 1 a pp 3 b iii 4 b pp 6 c pp 8 c iii Method 1 delete YourTable where [id] not in ( select max ([id

  • Reprinted: SQL to delete duplicate records with the N ways 2011-05-31

    State: The Article from http://blog.csdn.net/jeefchen/archive/2009/06/05/4246110.aspx (non-original) For example: id name value 1 a pp 2 a pp 3 b iii 4 b pp 5 b pp 6 c pp 7 c pp 8 c iii id is the primary key requirement to get this result id name val

  • Oracle query and SQL statement to delete duplicate records 2010-10-04

    Query and the SQL statement to delete duplicate records Query and the SQL statement to delete duplicate records 1, the lookup table in the extra duplicate records, duplicate records are based on a single field (peopleId) to determine select * from pe