Help with reordering rows (MySQL) - Printable Version
+- SA-MP Forums Archive (
https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (
https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (
https://sampforum.blast.hk/forumdisplay.php?fid=12)
+--- Thread: Help with reordering rows (MySQL) (
/showthread.php?tid=650398)
Help with reordering rows (MySQL) -
m1kas - 27.02.2018
Hey there, I was wondering if there was any way we could reorder rows with MySQL? For example, let's say I want to make a /toptime command, and for example if someone is in the first position and someone overtakes his position he moves on to the second position, then the person in the second position moves on to the third, etc. Any suggestions? Thanks.
Re: Help with reordering rows (MySQL) -
DobbysGamertag - 27.02.2018
Like this?
pawn Код:
SELECT `username`,`score` FROM `players` ORDER BY `score` ASC LIMIT 10
Selects and orders top 10 players by score asc (1, 2, 3 etc).
EDIT: Found a useful tutorial on the SQL Side of it
here. Click next page, and it will teach you all you need to know.
Re: Help with reordering rows (MySQL) -
m1kas - 27.02.2018
Not really, I already know how to get the TOP players, I just want to know how to change their positions, for example I have this table:
Код:
Position Username Time
1 Name 10
2 Name 22
3 Name 30
4 Name 44
5 Name 51
And if someone gets a time of lower than 10 seconds, he moves on the the first position, the person who WAS in the first position moves on the the second, and so on..
Re: Help with reordering rows (MySQL) -
m1kas - 27.02.2018
Nevermind, I figured it out on my own, lock.
Re: Help with reordering rows (MySQL) -
PepsiCola23 - 27.02.2018
Quote:
Originally Posted by m1kas
Nevermind, I figured it out on my own, lock.
|
post the solution so others can see how to solve this kind of problem.