Let's say I had a MySQL database with the following five records in a table:
ID: 1
Field1: A
Field2: B
Field3: C
ID: 2
Field1: D
Field2: E
Field3: F
ID: 3
Field1: A
Field2: H
Field3: I
ID: 4
Field1: J
Field2: K
Field3: A
ID: 5
Field1: M
Field2: D
Field3: O
Notice that the following values are duplicated:
ID 1, field 1 has the same value as ID 3, field 1 and ID 4, field 3.
ID 2, field 1 has the same value as ID 5, field 2.
Is there a SELECT statement that could find all of the above duplicates?
it is doable but not sure if it is any more efficient than just doing it at the application level:
your table:
the select to find dupes:
basically you union the three columns into one then look for dupes