My table looks something like:
ID | Type
01 | a
02 | c
03 | b
04 | a
05 | b
06 | a
I want to output the ID of the last added entries grouped by Type. ID is an auto-increment field so the last added entry is obviously the highest number.
SELECT * FROM `table` GROUP BY `Type` ORDER BY `ID` DESC, `Type` ASC
This groups the rows by Type then sorts by ID so I get IDs 1,2,3 whereas I want to sort first THEN group to get the result: 6,5,2