title: How to get a percentage in Mysql query in PHP based on wins/losses columns
body: <p>I need this Rank query to also have an IF statement to calculate the wins/losses and put the percentage in a <code>@percentage</code> variable. I have no idea how to combine a rank query with a percentage query. </p>
  
  <pre><code>mysql_query("SELECT name, wins, losses, level, xp, @curRank := @curRank + 1 AS rank 
  FROM teams p, (SELECT @curRank := 0) r 
  WHERE `console` = 3 AND `game` = 23 AND `laddertype` = 1 
  ORDER BY xp DESC");
  </code></pre>