Using Rank() Function Updating the Rank to TotalMarks in null
Using Rank() Function Updating the Rank to TotalMarks is not null
I'm updating the Rank based on the TotalMarks. If the TotalMarks is not null the rank is updating but (here the issue is) it should not allow to update the Rank if the TotalMarks is null.
How to resolve this?
Just use a CASE
expression
CASE WHEN TotalMarks IS NOT NULL THEN RANK() OVER (ORDER BY TotalMarks DESC) END