hello
I could use some help with MySQL.
to get the right entries from a table, I want to do the following:
- group by a certain ID; but from equal ID's only take the one with the newest DATE.
- then order by DATE (descending)
table example:
ID DATE
1 2002-01-02
1 2002-01-01
1 2002-01-08
2 2002-01-04
2 2002-01-05
then the result should be:
1 2002-01-08
2 2002-01-05
I tried the following, but it doesn't work:
SELECT * FROM mytable ORDER BY date GROUP BY id;
can anyone help me?