我想选择每个成员的最后一行。
ID UID POINT DATE TIME
1 1 5 2012-11-29 11:29:03
2 2 10 2012-11-29 11:38:12
3 1 10 2012-12-02 05:15:01
4 3 5 2012-12-02 09:51:34
5 2 5 2012-12-02 12:14:14
6 3 5 2012-12-04 12:18:30
7 1 5 2012-12-05 06:00:51
所以我想选择ID,UID和POINT,其中点是每个用户的最高点。结果应该是:
ID UID POINT DATE TIME
2 2 10 2012-11-29 11:38:12
3 1 10 2012-12-02 05:15:01
6 3 5 2012-12-04 12:18:30
我试过这个:
SELECT distinct uid, point, id FROM `test`
GROUP By uid ORDER BY date DESC, time DESC
和
SELECT id, uid, point FROM `test`
GROUP BY uid ORDER BY date DESC, time DESC
但我得到了一些错误的结果:
4(3), 2(2), 1(1)