title: Conditional sorting in MySQL?
body: <p>I have "tasks" table with 3 fields:</p>
  
  <ol>
  <li>date</li>
  <li>priority (0,1,2)</li>
  <li>done (0,1)</li>
  </ol>
  
  <p>What I am trying to achieve is with the whole table sorted by done flag, tasks that are not done should be sorted by priority, while tasks that are done should be sorted by date:</p>
  
  <ol>
  <li>Select * from tasks order by done asc</li>
  <li>If done=0 additionally order by priority desc</li>
  <li>If done=1 additionally order by date desc</li>
  </ol>
  
  <p>Is it possible to do this in MySQL without unions? </p>
  
  <p>Thanks.</p>