How to enumerate a column with update?

0

Hello, I'm new to sql and need help:

I have the following columns:

Usuário | Ranking | Posição 
Fulano      300        1
Ciclano     400        2 
Beltrano    500        3

I wanted to know how to put this position 1 2 3 ... without being manual as I do but through a sql command, always adding 1 more to stay in order: 1 2 3 4 5 ... and has that to be according to the ranking, who has lower rankings gets the top positions

I need a update command to do this, because every week I will have to change the positions.

I tried to use DECLARE @component = 1, but I could not use this command in SQL. Gave Unrecognized statement type error. (near "DECLARE"). I'm doing it for phpmyadmin. Could someone help me how to do this?

    
asked by anonymous 17.06.2018 / 06:34

0 answers