mysql 分组查询并取出各个分组中时间最新的数据

表  t_user_info

id  groupid  content  lasttime

select  *  from t_user_info t where not exists

(select * from t_user_info where groupid= t.groupid and t.lasttime<lasttime)

 

posted @ 2019-05-24 10:55  不文不问  阅读(1018)  评论(0编辑  收藏  举报