MySQL Forums
Forum List  »  Newbie

SELECT DUPLICATE RECORDS
Posted by: BigJon BigJon
Date: October 31, 2007 09:07AM

Is it possible to 'see' the duplicate records?
In my table i want to see all records where values in colA AND colB occur more than once.
A B C D
1 2 3 4
2 3 4 5
3 4 5 6
4 5 6 7
2 3 9 9
2 2 9 9

so i want to see (select) rows 2 and 5

Any ideas, please?

i can get what causes duplicates by this...
SELECT colA,colB,colC,colD,COUNT(*) FROM t1 GROUP BY colA,colB HAVING COUNT(*)>1
but then i have to
SELECT * FROM t1 WHERE colA=2 AND colB=3
but i need a lot of SELECT statements for my large tables!!



Edited 1 time(s). Last edit at 10/31/2007 09:35AM by BigJon BigJon.

Options: ReplyQuote


Subject
Written By
Posted
SELECT DUPLICATE RECORDS
October 31, 2007 09:07AM
October 31, 2007 09:35AM
October 31, 2007 11:48AM
October 31, 2007 09:56AM
November 01, 2007 03:16AM
January 25, 2008 01:16PM


Sorry, you can't reply to this topic. It has been closed.

Content reproduced on this site is the property of the respective copyright holders. It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.