
April 27th, 2007, 06:42 AM
|
|
Registered User
|
|
Join Date: Aug 2005
Posts: 25
Time spent in forums: 7 h 9 m 9 sec
Reputation Power: 0
|
|
|
Detect duplicate multiple-row-pair in SQL, is it possible?
In the table below column b contains parameters for column a.
Each a got 2 parameters b, thats why each a appears 2 times (on 2 rows).
I want to find duplicates of a. A duplicate a is defined as having the same b's as another a.
So in the table below a=1 and a=2 are a duplicate because they both got b=1 and b=2.
While a=3 and a=4 is "in the clear" so to speak.
Is it possible to do a SELECT where each row in the resultset means a duplicate?
Code:
+----+----+----+
| id | a | b |
+----+----+----+
| 1 | 1 | 1 |
| 2 | 1 | 2 |
| 3 | 2 | 1 |
| 4 | 2 | 2 |
| 5 | 3 | 1 |
| 6 | 3 | 3 |
| 7 | 4 | 2 |
| 8 | 4 | 3 |
+----+----+----+
|