SA-MP Forums Archive
Ordered mysql selection - 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: Ordered mysql selection (/showthread.php?tid=615525)



Ordered mysql selection - Ahmed21 - 23.08.2016

Hello, I want to make a command that displays all the registered admins in my server and ordered from high levels to low levels. Accounts are in a MySQL database, and I just want that query line, I forgot what was it but as I remember it was something like:

PHP код:
SELECT FROM accounts WHERE Admin != 0 ORDERED.. I FORGOOOT IT HELP ME 
Admins list should look like:
Level 5 - Ahmed
Level 4 - TheSuperWhatever
Level 4 - Huehuehuehue
Level 3 - IAmAdminLevel3
Level 2 - HoldenBee
Level 2 - MasterZ
Level 1 - Kingoy
Level 1 - AssassinoZ
Level 1 - PlueyZ
Level 1 - NolyF


Re: Ordered mysql selection - jlalt - 23.08.2016

try this sir.
PHP код:
SELECT FROM `accountsWHERE Admin 0 ORDER BY `accounts`.`AdminDESC 



Re: Ordered mysql selection - Shinja - 23.08.2016

PHP код:
SELECT FROM `accountsWHERE `Admin` > 0 ORDER BY `AdminDESC 



Re: Ordered mysql selection - Konstantinos - 23.08.2016

You don't need to select all the data but rather their name and level instead.

pawn Код:
"SELECT Admin, Name FROM accounts WHERE Admin <> 0 ORDER BY Admin DESC"



Re: Ordered mysql selection - Ahmed21 - 23.08.2016

Okay thank you all so much but, after I store the result, the first row in the result is gonna be admin level 1 or what?


Re: Ordered mysql selection - Shinja - 23.08.2016

The first row (0) is the highest level