当前位置:首页>开发>正文

mysql先排序后分组

2024-07-28 20:04:46 互联网 未知 开发

mysql先排序后分组?

mysql先排序后分组

用分组函数来做,假如你的表名是table_nameselect A.*from table_name A,(select product,max(date) max_date from table_name group by product) Bwhere A.product=B.product and A.date=B.max_date