mysql分组统计按照字段排序方法(分组之后保留最新时间、最大id...)

sql示例如下:

select success_time,query_time,order_no from pro_return_plan t where t.success_time in (
SELECT max(success_time)
FROM pro_return_plan
WHERE 1=1 AND bill_status='2'
AND success_time IS TRUE
AND order_no IN('20190416105437690','20190510193141046','20190511084814300','20190703191848850','20190703193148544')
GROUP BY order_no
ORDER BY success_time DESC
)

按照success_time分组并保留最新时间的项

posted @ 2019-08-09 17:03  007少侠  阅读(2196)  评论(0编辑  收藏  举报
友情链接:便宜vps(CN2GIA线路)
站长统计: