title: Finding most common values in each column
body: <p>Below is what I have in table <code>myTable</code>.</p>
  
  <pre><code>+--------+--------+--------+--------+
  | value1 | value2 | value3 | value4 |
  +--------+--------+--------+--------+
  |   9    |   4    |   3    |   3    |
  |   1    |   2    |   9    |   3    |
  |   1    |   2    |   3    |   4    |
  |   1    |   2    |   3    |   4    |
  +--------+--------+--------+--------+
  </code></pre>
  
  <p>I want output as </p>
  
  <pre><code>+--------+--------+--------+--------+
  | value1 | value2 | value3 | value4 |
  +--------+--------+--------+--------+
  |   1    |   2    |   3    |   4    |
  +--------+--------+--------+--------+
  </code></pre>
  
  <p><code>value1=1</code> because 1 is thrice in that column.</p>
  
  <p><code>value2=2</code> because 2 is thrice in that column.</p>
  
  <p><code>value3=3</code> because 3 is thrice in that column.</p>
  
  <p><code>value4=4</code> because 4 is twice in that column and that is maximum number of all common number in that column.</p>
  
  <p><strong>NOTE</strong> : <code>value4</code> has most common values as 3 and 4. In output I should get 4 as 4 is the greatest in 3,4.</p>
  
  <p>Can I achieve this in mysql?</p>
  
  <h2>Update 1</h2>
  
  <h2><a href="http://sqlfiddle.com/#!3/c3434" rel="nofollow">Table at SQL Fiddle</a></h2>
  
  <h2>Update 2</h2>
  
  <p>I am listing answer here also so that no need to go on js-fiddle. (as per @ypercube answer)</p>
  
  <pre><code>SELECT
    ( SELECT value1
      FROM myTable
      GROUP BY value1
      ORDER BY COUNT(*) DESC
             , value1 DESC
      LIMIT 1
    ) AS value1,
  
    ( SELECT value2
      FROM myTable
      GROUP BY value2
      ORDER BY COUNT(*) DESC
             , value2 DESC
      LIMIT 1
    ) AS value2,
  
    ( SELECT value3
      FROM myTable
      GROUP BY value3
      ORDER BY COUNT(*) DESC
             , value3 DESC
      LIMIT 1
    ) AS value3,
  
    ( SELECT value4
      FROM myTable
      GROUP BY value4
      ORDER BY COUNT(*) DESC
             , value4 DESC
      LIMIT 1
    ) AS value4
  ;
  </code></pre>