I have a table with about 20 columns and 2000 rows. Example:
Col1 Col2 Col3 Col4 ... A01 22 AB 11 A01 22 AX 112 A01 23 A5 11 A02 20 AB AA A04 21 AB 11 A04 21 AU 11 A04 29 AB BA A05 21 AB 11 AAA 111 XX 18 AAA 222 GT 1O ...
I need a select which displays all rows and all columns that satisfy the requirement of two columns (Col1 and Col2) based on the following:
if Col1 is unique - show row, or if Col1 is not unique show all row only if Col1 and Col2 are same. From the previos table is after select the result:
Col1 Col2 Col3 Col4 ... A01 22 AB 11 A01 22 AX 112 A02 20 AB AA A04 21 AB 11 A04 21 AU 11 A05 21 AB 11 AAA 111 XX 18 ...
The new table (your solution) contains data: Col1 Col2 Col3 Col4 ...
A01 22 AB 11
A01 22 AX 112
A02 20 AB AA
A04 21 AB 11
A04 21 AU 11
A05 21 AB 11
AAA 111 XX 18
...
what I wont see from this is:
Col1 Col2 Col3 Col4 ...
A01 2 AB 11
A02 1 AB AA
A04 2 AB 11
A05 1 AB 11
AAA 1 XX 18
...