Quote:
Originally Posted by saamp
maddinat0r, I need an answer ; I want to create a Top Players with some fields ( level, money, crimes, etc. ). The database is actually big enough ( + 500.000 accounts ). Do I have to make 3 threaded queries for all of this?
For example:
pawn Код:
// CMD:top(playerid, params) mysql_tquery(SQL, "SELECT level FROM accounts ORDER BY level DESC LIMIT 5", "TopLevel", "d", playerid); mysql_tquery(SQL, "SELECT money FROM accounts ORDER BY money DESC LIMIT 5", "TopMoney", "d", playerid); mysql_tquery(SQL, "SELECT crime FROM accounts ORDER BY crime DESC LIMIT 5", "TopCrime", "d", playerid);
pawn Код:
forward TopLevel(const playerid); public TopLevel(const playerid) { if(!IsPlayerConnected(playerid)) return 1;
// My Top Level Code ............. strcat(largeString, editedString); // ...................................... return 1; }
forward TopMoney(const playerid); public TopMoney(const playerid) { if(!IsPlayerConnected(playerid)) return 1;
// My Top Money Code ........................ strcat(largeString, editedString); // ......................................
return 1; }
forward TopCrime(const playerid); public TopCrime(const playerid) { if(!IsPlayerConnected(playerid)) return 1;
// My Top Crime Code ....................... strcat(largeString, editedString); // ......................................
ShowPlayerDialog(playerid, 0, DIALOG_STYLE_MSGBOX, "Top Players", largeString, "OK", ""); return 1; }
|
Yes, but you should use LIMIT. For example if you want top 30 put "LIMIT 30" at the end of the query.