Return to Snippet

Revision: 39888
at January 22, 2011 04:47 by ezerick


Initial Code
select * from table where field1 + field2 + field3 in 
(
	select field1 + field2 + field3 from table group by field1 + field2 + field3 having count(*) > 1
) 
and uniqueID not in 
(
	select MAX(uniqueID) from xer_regis_new group by field1 + field2 + field3 having count(*) > 1
)

Initial URL


Initial Description
Field1 + Field2 + Field3 should create 1 entry for each unique row in the DB. In an employee table, this would be FirstName + LastName + EmployeeNumber

Initial Title
Find Duplicate Rows in Table

Initial Tags
database, sql

Initial Language
SQL