How can I group a column and then order those rows by another column?
Table:
+------+-----+
| data |number|
+------+-----+
| AAA | 2000 |
| AAA | 3000 |
| BBB | 2001 |
| AAA | 1000 |
| BBB | 1001 |
| CCC | 1002 |
+------+-----+
Query:
SELECT data,number FROM table GROUP BY data ORDER BY number DESC
Why does this query not produce the following?
AAA 3000
BBB 2001
CCC 1002
I want to group the data and then find the biggest number
Thanks in advance for any help