title: SQL: Combine multiple columns into one for sorting (output only)
body: <p>I have a database like this:</p>
  
  <pre><code>|--------------------------------------------------------------------------|
  | NAME               |  SCORE1  |  SCORE2  |  SCORE3  |  SCORE4  |  RATING |
  |--------------------------------------------------------------------------|
  | Joe Bloggs         |  -50     |  0       |  -10     |  -30     |  67     |
  | Bob Bobbing        |  -30     |  -10     |  0       |  -10     |  74     |
  | Marjorie Doors     |  0       |  -10     |  -30     |  -50     |  88     |
  | etc... ------------------------------------------------------------------|
  </code></pre>
  
  <p>What I am trying to do is to find the highest-rated name for any given score position.</p>
  
  <p>I do fine when there is only one score position possible:</p>
  
  <pre><code>SELECT name FROM db ORDER BY Score2 DESC, Rating DESC LIMIT 1
  </code></pre>
  
  <p>...gives me the highest-rated person with the best score for Score2.</p>
  
  <hr>
  
  <p>What I now need is to find a way to combine two or more score columns (there are 23 in total) but still return the highest-rated person for any score combination given.</p>
  
  <p>For example, if I wanted the highest-rated person for Score2 OR Score3, doing the above query gives me Joe Bloggs even though his rating is lower than Bob Bobbing's.</p>
  
  <p>Similarly, if I wanted the highest-rated person for Score1 OR Score2 OR Score4, I'd still need to specify one of the scores to sort by first. I need a way to combine the results of all X columns specified, THEN sort by the combined score 'column', then by rating.</p>