mysql 先排序再分组取时间最近的数据
mysql 先排序分组后取时间最近的数据先直接上sql,解释后续有时间再写SELECT * FROM ( SELECT v.* FROM people v INNER JOIN (SELECT MAX(add_time) 'max_add_time' FROM people GROUP BY name , age , sex ) c ON v.add_time = c.max_add_time WHERE v.`status` IN ( '1' , '2' , '3' , '4' ) )
原创
2020-05-25 16:49:01 ·
1313 阅读 ·
0 评论