Search

SQL: How to assign the same line number to lines with the same value?

SQL: How to assign the same line number to lines with the same value?

I have a table like below in SQL Server. I reach the row number values with using ROW_NUMBER partition function. But this was not the result I wanted to achieve.

RowNumber Value
1 A
2 A
3 A
1 B
2 B
1 C
1 D

I want to get this table

RowNumber Value
1 A
1 A
1 A
2 B
2 B
3 C
4 D

How can I do it, do you have a function suggestion?