ORDER BY ... Some small help. - 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: ORDER BY ... Some small help. (
/showthread.php?tid=372615)
ORDER BY ... Some small help. -
Edvin - 27.08.2012
Hi guys:
pawn Код:
format( szQuery, sizeof szQuery, "SELECT `Name`,`GangKills` FROM `Accounts` ORDER BY (`GangKills`) WHERE `GangID` = '%d' DESC LIMIT 5", GangID );
I have this syntax, and when I use it, this appear in "debug.txt":
Код:
[18:35:27] errorid: 1064 | error: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'WHERE `GangID` = '2' DESC LIMIT 5' at line 1 | resultid: 22 | extraid: -80652920 | callback: OnQueryFinish | query: SELECT `Name`,`GangKills` FROM `Accounts` ORDER BY `GangKills` WHERE `GangID` = '2' DESC LIMIT 5
What is wrong?
Re: ORDER BY ... Some small help. - HuSs3n - 27.08.2012
try this
AFIAK WHERE should be used before ORDER BY
pawn Код:
format( szQuery, sizeof szQuery, "SELECT `Name`,`GangKills` FROM `Accounts` WHERE `GangID` = '%d' ORDER BY (`GangKills`) DESC LIMIT 5", GangID );
Re: ORDER BY ... Some small help. -
ddnbb - 27.08.2012
This might not help you or fix the problem, but doesnt 'sizeof' be like this? "sizeof(szQuery)" instead of "sizeof szQuery"
Re: ORDER BY ... Some small help. - HuSs3n - 27.08.2012
Quote:
Originally Posted by ddnbb
This might not help you or fix the problem, but doesnt 'sizeof' be like this? "sizeof(szQuery)" instead of "sizeof szQuery"
|
it can be used in both ways
Re: ORDER BY ... Some small help. -
Unte99 - 27.08.2012
A hint:
Re: ORDER BY ... Some small help. -
Edvin - 28.08.2012
Quote:
Originally Posted by HuSs3n
try this
AFIAK WHERE should be used before ORDER BY
pawn Код:
format( szQuery, sizeof szQuery, "SELECT `Name`,`GangKills` FROM `Accounts` WHERE `GangID` = '%d' ORDER BY (`GangKills`) DESC LIMIT 5", GangID );
|
Thanks, now works
Quote:
Originally Posted by ddnbb
This might not help you or fix the problem, but doesnt 'sizeof' be like this? "sizeof(szQuery)" instead of "sizeof szQuery"
|
It doesn't matter, you can use with "sizeof
( szQuery
)" or without ...