I have this line of code:
ROW_NUMBER() OVER (ORDER BY V_CONSTAT_ACTUAL_DATES.DATE_TO_END) AS SortOrder
but this starts at 1..... How do I get it to start at 0?
I've tried ROW_NUMBER() - 1 but that didn't work. I also tried 1 - ROW_NUMBER() but that gives me 0 then -1.
You can try ROW_NUMBER() OVER (ORDER BY V_CONSTAT_ACTUAL_DATES.DATE_TO_END) - 1 AS SortOrder
select ROW_NUMBER() OVER (ORDER BY [ColumnName]) - 1 AS SortOrder from temp_table
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With