I know we can generate row_number in select statement. But row_number starts from 1, I need to generate from 2 and onwards.
example
party_code
----------
R06048
R06600
R06791
(3 row(s) affected)
I want it like
party_code serial number
---------- -------------
R06048 2
R06600 3
R06791 4
Current I am using below select statement for generate regular row number.
SELECT party_code, ROW_NUMBER() OVER (ORDER BY party_code) AS [serial number]
FROM myTable
ORDER BY party_code
How can modify above select statement and start from 2?
to add:
ROW_NUMBER()has an unusual syntax, and can be confusing with the variousOVERandPARTITION BYclauses, but when all is said and done it is still just a function with a numeric return value, and that return value can be manipulated in the same way as any other number.