小编Ami*_*ila的帖子

基于累积值的排名

I want to rank on ID and value columns based on ascending order of UID. Expected output has to change once value column has a different value than the previous value. Ranks has to restart on each new ID

UID ID  Value Expected Output
1   1   0         1
2   1   0         1
3   1   1         2
4   1   1         2
5   1   1         2
6   1   0         3
7   1   1         4
8   1   0         5
9   1   0         5 …
Run Code Online (Sandbox Code Playgroud)

sql sql-server rank window-functions gaps-and-islands

5
推荐指数
1
解决办法
70
查看次数