MySQL – 先排序后分组

业务需求:电话号码相同的,根据时间取最新一条数据

select * from b_guest_info a where create_at = (select max(create_at) from b_guest_info b where a.mobile = b.mobile) order by create_at desc

  

posted @ 2021-06-16 13:46  蛋挞小子  阅读(489)  评论(0编辑  收藏  举报