Skip to content
Advertisement

SQL: Sort rows based on attribute order

I want to sort an the value of an attribute (called position) to the row number of another attribute’s ordering.

Example: If I have the following attributes: position, points I’d like to order the table by points (descending), then assign position the ordered row numbers ex.

Advertisement

Answer

You can do that using window functions row_number()

Since the OP wants to update the records

User contributions licensed under: CC BY-SA
5 People found this is helpful
Advertisement