Is it possible to have select query with order by and as a result insert new column with position of each row ?
for example I have table:
Name
-------
A
D
D
B
C
B
and as a result I would like to have table:
Name Position
-------------
A 1
D 4
D 4
B 2
B 2
C 3
thanks for any help
Use DENSE_RANK
This will produce
so it may be difficult to maintain the original ordering