我想要表记录如下:
---------------------------------------------------------------------------
id | receiver_user_id | sender_user_id | message_text | insertdate
---------------------------------------------------------------------------
6 | 33 | 42 | OLD | 2013-05-08 10:08:53
8 | 33 | 43 | ddddd | 2013-05-07 19:01:45
7 | 33 | 38 | Ipsum | 2013-04-25 10:27:35
---------------------------------------------------------------------------
我正在使用这个查询:
SELECT *
FROM (`player_messages`)
WHERE `receiver_user_id` = '33'
GROUP BY sender_user_id
ORDER BY `player_messages`.`insertdate` DESC
并获取如下表记录。
---------------------------------------------------------------------------
id | receiver_user_id | sender_user_id | message_text | insertdate
---------------------------------------------------------------------------
6 | 33 | 43 | ddddd | 2013-05-07 19:01:45
4 | 33 | 42 | NEW | 2013-05-07 10:08:58
7 | 33 | 38 | Ipsum | 2013-04-25 10:27:35
---------------------------------------------------------------------------
请帮忙。提前致谢。