Get the second best SQLite score
#1

Hello, well, I have a doubt, here, in this code that I leave you I get the first 15 users of the table, that is, the top. What I want to know is how I get the stats of the second best user, and the third and so, but only individually and not all together and ordered, I do not know if I explain, thank you.

Код:
format(Query,sizeof(Query),"SELECT `Nick` FROM `Usuarios` ORDER BY (`Score` * 1) DESC limit 15");
resultado = db_query(BaseDeDatos,Query);
For example the first best "score" would go in this textdraw

Код:
Textdraw5 = TextDrawCreate (122.234283, 356.492949, "[S] peed_.");
TextDrawLetterSize (Textdraw5, 0.199341, 1.337499);
TextDrawAlignment (Textdraw5, 1);
TextDrawColor (Textdraw5, -1);
TextDrawSetShadow (Textdraw5, 0);
TextDrawSetOutline (Textdraw5, 1);
TextDrawBackgroundColor (Textdraw5, 51);
TextDrawFont (Textdraw5, 2);
TextDrawSetProportional (Textdraw5, 1);
Reply
#2

pawn Код:
SELECT Nick FROM Usuarios GROUP BY Score ORDER BY Score DESC LIMIT 1 OFFSET N;
where N = nth - 1. Since offset starts from 0, the 2nd highest score is OFFSET 1.
Reply
#3

Код:
CALLBACK: ActualizarTds(playerid)
{
	new asdasdasd[87];
	format(asdasdasd,sizeof(asdasdasd),"~w~%s",); //Here would have to leave the first nick of the best score sqlite
	TextDrawSetString(prahxdxd5[playerid], asdasdasd);
	TextDrawShowForPlayer(playerid, prahxdxd5[playerid]);
    new Query[356];
    new DBResult:resultado;
    format(Query,sizeof(Query),"SELECT Nick FROM Usuarios GROUP BY Score ORDER BY Score DESC LIMIT 1 OFFSET N;");
	resultado = db_query(BaseDeDatos,Query);
}
And the code is not working at all
Reply
#4

Uhm yeah, you're supposed to replace N with the ranking number.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)