title: mysql group by 2 columns combine results
body: <p>I'm trying to work out how I want to structure this query and am having a bit of difficulty.</p>
  
  <p>Basically, I am trying to get a count of the most used ids in a row where the ids represent objects in another table , except the id can occur in 2 columns.  </p>
  
  <p>When I was just dong it for one column, this query worked fine:</p>
  
  <pre><code>SELECT rb_1,
         Count(*) AS num
  FROM   ci_lineups
  GROUP  BY rb_1
  ORDER  BY Count(*) DESC
  LIMIT  10
  </code></pre>
  
  <p>But now I'll be wanting to do a similar thing, except check a column called <code>rb_2</code> as well which can have all the id's <code>rb_1</code> will have.  </p>
  
  <p>When I try to group by the 2 columns it just considers the groups as combinations of the two columns.</p>
  
  <p>I can write a quick script in PHP to combine and sort the counts if I use my first query twice, once on each column, but I'm thinking there's probably a way to do this with MySQL.</p>