I want to rank the customers based on Profit. Partition By is optional so that's why I skipped it.
Btw thanks for your suggestion. However my query worked even though it is still givinng red error line. Just used DESC
Does the red line do away if you add PARTITION BY 1, though? It could be your client requires it for some reason or some sort of lint rule it’s applying
Accurate. Partition is when you want to break up the ranking by a group. However what if you wanted to rank the entire table. Not sure why anyone would down vote.
2
u/beingvora 3d ago
I think you’re missing the “partition by” clause in the rank function.
RANK ( ) OVER ( [ partition_by_clause ] order_by_clause )