MySQL排序函数整理
1. ROW_NUMBER()
# 记录行号
SELECT
ROW_NUMBER() OVER (ORDER BY `XXX` DESC) AS `Rank`,
`colum_name` AS `name`
FROM `table_name`
2. RANK()
# 记录排名 (并列 跳跃)
SELECT
RANK() OVER (ORDER BY `XXX` DESC) AS `Rank`,
`colum_name` AS `name`
FROM `table
2024-11-08