mysql分组查询
发布网友
发布时间:2022-04-25 09:21
我来回答
共2个回答
热心网友
时间:2022-04-07 18:43
SELECT
s.*
FROM
(
SELECT
s.sap_distributor_code,
s.biz_month,
MAX( s.paas_update_time) paas_update_time
FROM
table_name s
GROUP BY
s.sap_distributor_code,
s.biz_month
) m
LEFT JOIN table_name s ON m.sap_distributor_code = s.sap_distributor_code
AND m.biz_month = s.biz_month
AND m.paas_update_time = s.paas_update_time
热心网友
时间:2022-04-07 20:01
select sap_distributor_code,biz_month,paas_update_time from table_name group by sap_distributor_code,biz_month order by paas_update_time desc limit 1