title: Order by "count (columns not null)"
body: <p>I'm looking at a way to order the MySQL results by a count of the columns where the value is not null. Therefore,</p>
  
  <pre><code>[id] [1] [1] [0] [1] [1] = 4
  
  [id] [0] [1] [1] [1] [0] = 3
  
  [id] [0] [0] [0] [1] [1] = 2
  
  [id] [1] [0] [0] [0] [0] = 1
  </code></pre>
  
  <p>In the above case I'm ignoring the ID column but in practice I wouldn't care. ID is always NOT NULL so adding it to count wouldn't change the results.</p>
  
  <p>Anyone have any idea on this that doesn't involve doing a PHP parse on the result into a new array? I'm trying to keep the processing portion in the DB level.</p>