php - Ranking with ORDER BY DESC, but updates the column -
php - Ranking with ORDER BY DESC, but updates the column -
hey have ladder ranking data:
ignore wins, loses, lvl.
the problem is, on team table have column ranking, ranking i'm using on table on image variable starts in 0 , increments 1 when finishes while cyclo. how update ranking column real ranking ordered points?
you can update/join:
update rankings r  bring together        (select r.id, @rn := @rn + 1 ranking         rankings r cross  bring together              (select @rn := 0) vars         order points desc        ) rp        on r.id = rp.id     set r.ranking = rp.ranking;    the subquery uses variables calculating ranking.
 php mysql sql 
 
Comments
Post a Comment