SA-MP Forums Archive
Question about mySQL ordering - 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: Question about mySQL ordering (/showthread.php?tid=338277)



Question about mySQL ordering - MP2 - 29.04.2012

I'm making a leaderboard. It's for the Kickstart Stadium. The two affecting values are the amount of points you got (0-60) and the time. I need to factor these BOTH in to the ordering, so if two people got 50 points, the one with the shortest time is higher on the leaderboards.

I already know how to do ordering, just not sure how to do both because one is asc and one is desc.

Thanks.


Re: Question about mySQL ordering - Hiddos - 29.04.2012

You could try something similar to this, assuming you want it to sort it by highest points and shortest time.

pawn Код:
mysql_query("SELECT * FROM table_name ORDER BY points DESC, time ASC");



Re: Question about mySQL ordering - MP2 - 29.04.2012

Works great, thanks.

I get these weird errors in phpMyAdmin when I send the query though:

unknown table status: TABLE_TYPE
unknown table status: TABLE_TYPE
unknown table status: Comment
unknown table status: TABLE_TYPE
unknown table status: TABLE_TYPE
unknown table status: TABLE_TYPE