I have a table structure like this :
-----------------------------------
ID | NAME | SORTED_ID
-----------------------------------
1 | B |
2 | D |
3 | A |
4 | C |
Using a single SQL query i want to update the SORTED_ID column like this, based on the sorted order.
-----------------------------------
ID | NAME | SORTED_ID
-----------------------------------
1 | B | 2
2 | D | 4
3 | A | 1
4 | C | 3
How can i do so?