I am trying to update the ColumnNo field to display the same number when the AppID and FootNote are the same. I need it to display like the first image below.
I have tried
ROW_NUMBER() Over (partition by AppID, FootNote Order by AppID) as RowNum
Which works in reverse.
And some other functions to no avail. How can I flip this?
Advertisement
Answer
Use dense_rank()
:
row_number() Over (order by AppID, FootNote) as RowNum