I would like to rank sequential rows with the null value inside a group of the same natural key. The database is oracle.
Here’s the example :
NAT_KEY ATTRIBUTE_A ORDERED_FIELD RANK
A A 1
A 2 1
A A 4
A I 6
A 8 1
A 10 2
A 11 3
B 2 1
B 3 2
B A 5
B A 6
B 9 1
C A 1
C A 5
C I 6
C 7 1
C 8 2
There must be a way with row_number() function, level and connect by or another one.
I finally figured it out with Andriy M’s link.
Here’s the solution :
Thanks!