SELECT
*
FROM
( SELECT *, ROW_NUMBER() OVER ( PARTITION BY REPORT_ID ORDER BY CREATE_TIME DESC ) AS row_num FROM t_hr_report_year_health ) t
WHERE
row_num = 1;
mysql 分组查询获取所有组内第一名
最新推荐文章于 2024-08-17 13:24:35 发布
SELECT
*
FROM
( SELECT *, ROW_NUMBER() OVER ( PARTITION BY REPORT_ID ORDER BY CREATE_TIME DESC ) AS row_num FROM t_hr_report_year_health ) t
WHERE
row_num = 1;