SELECT a.* FROM chat_log a INNER JOIN (SELECT id,MAX(id) id_,to_user FROM chat_log GROUP BY to_user)b ON a.to_user=b.to_user AND a.id=b.id ORDER BY a.to_user;
时间: 2024-10-11 00:22:03
SELECT a.* FROM chat_log a INNER JOIN (SELECT id,MAX(id) id_,to_user FROM chat_log GROUP BY to_user)b ON a.to_user=b.to_user AND a.id=b.id ORDER BY a.to_user;