I want to select rows that have the same value in column1 and column2 but differ in column3.
Here's my table.
| column1 | column2 | column3 |
|---|---|---|
| a | J | abc |
| a | K | def |
| a | L | xyz |
| b | J | abc |
| b | J | def |
| b | L | xyz |
| c | K | def |
| c | K | def |
Here's the output I want.
| column1 | column2 |
|---|---|
| b | J |
Here's what I tried.
SELECT column1, column2
FROM my_table
GROUP BY column1, column2, column3
HAVING COUNT(column1) > 1;