I have a simple 2-column table, where both columns are integers:
3;1
1;2
2;1
Let’s call the columns ‘a’ and ‘b’, respectively.
Please notice that two rows have the value 1 for column b.
What SQL query would allow me to get all rows in this table, but
only one row (no preference – 1;1 or 2;1) when there are multiple
rows with the same value in the column b?
In other words either of these resultsets is fine:
3;1
1;2
OR
1;2
2;1
because we have exactly 1 row for any particular value of b.
Note that it would work equally with MIN, FIRST or LAST