I have this data on a table called messages (id, category, user) :
1 1 aaa
2 2 aaa
3 3 aaa
4 1 bbb
5 2 aaa
6 1 ccc
7 2 aaa
8 3 ddd
I’d like to return only one row, with the number of row for the category 1 (in the example 3) and the last id of that category (in the example 6).
How can i do it with a MySql query?
1 Answer