I need to get the maximum ID in each group of UIDs.
ID UID 23 1 24 1 25 2 26 2
Would give:
ID UID 24
Use the MAX-operator and group by UID.
UID
SELECT MAX(t.ID), t.UID FROM yourtable AS t GROUP BY t.UID;