Select unique rows based on 2 columns
Posted: Wed Jul 16, 2008 8:27 am
Hi,
I have a table with 4 columns, I'd like to pull out only rows with a unique combination of column 2 and column 4.
For example:
table: col1, col2, col3, col4
row1: abc, 1, 11, def
row2: qrs, 1, 25, def
row3: xyz, 7, 2, xyz
row4: lmn, 6, 3, def
I would like to pull out ONLY rows 3 and 4, since they both have a unique combination of column 2 and column 4.
Is there any way i can do this?
I know i can use distinct to select unique rows based on the 2 columns, but that will also give me 1 of the 2 rows that have the same combo...
thank you!
I have a table with 4 columns, I'd like to pull out only rows with a unique combination of column 2 and column 4.
For example:
table: col1, col2, col3, col4
row1: abc, 1, 11, def
row2: qrs, 1, 25, def
row3: xyz, 7, 2, xyz
row4: lmn, 6, 3, def
I would like to pull out ONLY rows 3 and 4, since they both have a unique combination of column 2 and column 4.
Is there any way i can do this?
I know i can use distinct to select unique rows based on the 2 columns, but that will also give me 1 of the 2 rows that have the same combo...
thank you!