当前位置:Gxlcms > 数据库问题 > mysql分组取每组大的记录

mysql分组取每组大的记录

时间:2021-07-01 10:21:17 帮助过:19人阅读

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;  

 

mysql分组取每组大的记录

标签:group by   sel   inner   code   order by   select   log   blog   sql   

人气教程排行