使用 "Rank()" 函数,我需要根据 TotalMark 更新排名,但标记不应为 Null
Using "Rank()" Function I need to update the Rank based on the TotalMark but marks should not be Null
使用 Rank() 函数将排名更新为 null 中的 TotalMarks
使用 Rank() 函数将排名更新为 TotalMarks 不为空
我正在根据 TotalMarks 更新排名。如果 TotalMarks 不为空,则排名正在更新,但(这里的问题是)如果 TotalMarks 为空,则不应允许更新排名。
如何解决?
只需使用 CASE
表达式
CASE WHEN TotalMarks IS NOT NULL THEN RANK() OVER (ORDER BY TotalMarks DESC) END
使用 Rank() 函数将排名更新为 null 中的 TotalMarks
使用 Rank() 函数将排名更新为 TotalMarks 不为空
我正在根据 TotalMarks 更新排名。如果 TotalMarks 不为空,则排名正在更新,但(这里的问题是)如果 TotalMarks 为空,则不应允许更新排名。
如何解决?
只需使用 CASE
表达式
CASE WHEN TotalMarks IS NOT NULL THEN RANK() OVER (ORDER BY TotalMarks DESC) END