ORACLE:
Delete duplicate records in the database
Select corpname, count (*) from tbcorp group by corpname having count (*)> 1
Delete from tbcorp A where a. rowid! = (Select Min (B. rowid) from tbcorp B where a. corpname = B. corpname)
The project applied to the Local Adjustment Center has the following SQL statement:
Select blockid, nodeno, count (*) from geop group by blockid, nodeno having count (*)> 1
Identify duplicate points, and use two conditions to judge...
The following is used to delete duplicate records in the database, but keep one record;
Method 1:
/* First save the unique record. SQL Server 2000 supports table changes */
Declare @ rstemp table (Code int, coderule varchar (50 ))
Insert into @ rstemp select distinct code, coderule from
/* Cancel all records */
Delete from
/* Re-insert the data */
Insert into a select * From @ rstemp
Method 2:
Delete tablename from (select PK, max (Repeat field) as K from tablename group by PK having count (*)> 1) as B, tablename where tablename. PK = B. PK and tablename. repeated Fields
This was originally an article published on my blogger , because blogger needs to be upgraded, and nnd is so annoying, you have to re-stick all the articles to upgrade. By the way, put all the technical articles here! The original Article may refer to:
http://www.cnblogs.com/wertou/archive/2006/03/29/362214.html