Say I have the table of the following format
UID | A | B
----------------
1 2 1
2 5 1
3 4 1
4 3 2
5 8 2
6 7 2
7 4 3
8 1 3
9 6 3
I want to select the UID that corresponds to the MAX(A) grouped by B
The following statement would not work because MAX(UID) is independent from MAX(A)
SELECT MAX(UID), MAX(A), B
FROM Table
GROUP BY B
The data I wanted returned would like like the following
UID | A | B
----------------
2 5 1
5 8 2
9 6 3