|
|
|||||||||
|
|||||||||
|
|||||||||
| |
|||
| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Display Modes |
|
#1
|
|||
|
|||
|
Finding and omitting duplicate pairs across mutiple rows
I have an issue where I am trying to remove duplicate set pairs from a table.
I initially have a table "role", with the following data in it: r1id| r2id ---+----- 1 | 2 1 | 3 2 | 1 2 | 3 3 | 1 3 | 2 The data in this table is a set {r1id, r2id}; This means that 1, 2 and 2, 1 are logically equivalent(and so forth). so what I am trying to do is remove the duplicates {2,1} {3,1} {3,2} Anyone have any idea how to go about this? I have been banging my head on the table for a day trying to figure this out. Any help would be really appreciated ![]() |
|
#2
|
|||
|
|||
|
Never mind... I have the answer and its stupidly simple
![]() select * from role where r1id < r2id |
![]() |
| Viewing: Dev Articles Community Forums > Databases > General SQL Development > Finding and omitting duplicate pairs across mutiple rows |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|
|