-1

Table is called teams, need to get the following columns... name, wins, losses, percentage, level, xp WHERE console = 3 AND game = 23 AND laddertype = 1 I'm in need of a Rank column to be included with the dataset.

  • 2
    Why not just ORDER BY xp then add the rank number in the application? – Neghtasro Nov 19 '14 at 14:27
  • I answered a very similar question here: dba.stackexchange.com/questions/73168/… but I warned that that wasn't MySQL's way of doing things. – jynus Nov 19 '14 at 15:46
1

$result = mysql_query("SET @Rank := 0");

$result = mysql_query("SELECT *, @Rank := @Rank + 1 AS Rank FROM teams ORDER BY xp DESC, created ASC");

| improve this answer | |
  • that code seemed to do the trick – marxizmmarxizm Nov 19 '14 at 23:03

Not the answer you're looking for? Browse other questions tagged or ask your own question.