I have the following data:
cl1 -------- pl1
cl2 -------- pl1
cl3 -------- pl2
pl1 has is related to two different values in column1 (cl1,cl2) .what I need is a query that returns pl1 and any other values in column2 that corresponds to more than one value in column1.
Best How To :
something like this may work; but it really depends on context and use.
SELECT count(distinct column1), column2
GROUP BY column2
HAVING count(distinct column1) > 1
Distinct is only necessary if column1 can have the same value multiple times in compared to column2... For example...
cl1 pl1 <-- if data like this and before doesn't exist then you don't need the distinct