Consider a table like the following:
col1 col2 col3
1000 RRR 100000
2000 RRR 400000
3000 RRR 300000
4000 YYY 200000
5000 YYY 400000
6000 RRR 400000
6000 ZZZ 500000
The output I want:
1000 RRR 0
2000 RRR 300000
3000 RRR 100000
6000 RRR 400000
....
I need to perform partition on col2
, order by on col3
and then find difference on rows.
Like this
` – ZetaPR Jan 27 '20 at 14:39