I'm trying to write a MySQL query (from PHP) that will find the newest (highest ID number) score for each unique value in the group column.
I've tried a few different combinations of max() and GROUP BY but can't get it to work.
Here is an example of my table:
ID | my_group | score
1 | red | good
2 | blue | bad
3 | red | bad
4 | blue | good
5 | red | good
6 | yellow | bad
7 | blue | good
8 | blue | bad
9 | yellow | good
10 | blue | bad
So what I want to be returned from the above table would be:
ID | my_group | score
10 | blue | bad
9 | yellow | good
5 | red | good