--根据 x 分组后、根据 y 排序后取第一条 select * from ( select ROW_NUMBER() over(partition by x order by y desc) RowNum ,testTable.* from testTable) as t1 where RowNum = 1
MySQL分组取每组前一(或几)条记录(排名)
2023-11-25 08:03:58
--根据 x 分组后、根据 y 排序后取第一条 select * from ( select ROW_NUMBER() over(partition by x order by y desc) RowNum ,testTable.* from testTable) as t1 where RowNum = 1