versuchen Sie Folgendes:
SET @rank = 0;
SELECT rank FROM (
SELECT @rank:[email protected] + 1 AS rank, uid FROM playerstats ORDER BY overall DESC,
overallxp DESC
) as tmp WHERE uid = 14950
Die obige Abfrage gibt den Rang für Benutzer14950
zurückDiese Abfrage listet alle Benutzer und ihre Ränge auf
SET @rank=0;
SELECT rank, uid, overall, overallxp FROM (
SELECT @rank:[email protected] + 1 AS rank, uid, overall, overallxp FROM playerstats ORDER BY overall DESC, overallxp DESC
) as tmp