Skip to content
Advertisement

Update the ColumnNo field to display the same number when the AppID and FootNote are the same

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.

Bad Data

I have tried

ROW_NUMBER() Over (partition by AppID, FootNote Order by AppID) as RowNum

Which works in reverse.

What I Need

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
User contributions licensed under: CC BY-SA
4 People found this is helpful
Advertisement