SELECT *
,ROW_NUMBER() OVER (ORDER BY RecordPriority, TablePriority) AS FilteringColumn
FROM
(
SELECT t1.*
,RANK AS RecordPriority
,1 AS TablePriority
FROM T1
UNION ALL
SELECT t1.*
,RANK AS RecordPriority
,2 AS TablePriority
FROM T1
UNION ALL
SELECT t1.*
,RANK AS RecordPriority
,3 AS TablePriority
FROM T1
) DS
1条答案
按热度按时间3z6pesqy1#
您可以统一数据并设置自定义表优先级(取决于您的需要),然后使用当前的行顺序和新列再次对数据进行排名。它看起来像这样:
然后,您可以使用
FilteringColumn
轻松获取行。