I have a table like this in MS SQL SERVER 2014:
ID|Race|Lap
1 |21 |11
2 |21 |NULL
3 |21 |NULL
4 |21 |NULL
5 |29 |65
6 |29 |NULL
7 |29 |NULL
8 |29 |NULL
I am trying to fill up the Lap column by adding 1 to it based on the first value. The partition is based on Race column. Something like this would be the end result:
ID|Race|Lap
1 |21 |11
2 |21 |12
3 |21 |13
4 |21 |14
5 |29 |65
6 |29 |66
7 |29 |67
8 |29 |68
There might be other ways of doing this but I would rather stick with recursive CTE. Is there any way to do this?