title: SQL sorting with conditions
body: <p>I have a table with players. The admin wants to sort the players by a condition. If column <code>activerank = 1</code> then the player adds to sorting else if <code>activerank = 2</code> the player should be shown at the end of players. How can I do this?</p>
  
  <p>Here is my query, without this condition:</p>
  
  <pre><code>$sql = '
    SELECT c.*
    FROM `child` AS c
    WHERE  '
    c.`id` &gt; 0
    ' ORDER BY c.`rank` DESC ';
  </code></pre>