SQL Simple ORDER BY
Posted
by
AeroDroid
on Stack Overflow
See other posts from Stack Overflow
or by AeroDroid
Published on 2010-12-25T08:00:42Z
Indexed on
2010/12/25
9:54 UTC
Read the original article
Hit count: 317
I'm new to SQL and I don't think this question should be hard to answer. I have a high-score table for a game that contains the columns name, score, and rank. I want to know how I can order the table by descending order each time a new score is added so the table can always stay ordered by score.
I know this is the wrong way of doing this, but I hope this makes my point kind of clearer.
UPDATE `HSTable`.`Highscores` ORDER BY `Highscores`.`score` DESC;
What is the correct way of approaching this?
One more thing, is there a way I can set it so that the ranking value always stays where it's suppose to be from the SQL, for example, 1st place is always at the top regardless the score?
Thanks!
© Stack Overflow or respective owner