title: SQL get array in postgresql
body: <p>Have a table(test):</p>
  
  <pre><code>  color              |  count_var  | 
   --------------------+-------------+
    red &amp; white        |          15 |
    black &amp; white      |          10 |
    black              |          10 |
    black &amp; white      |          15 |
    red &amp; white        |          15 |              
  </code></pre>
  
  <ol>
  <li>At first I need to GROUP BY the 'count_var'</li>
  <li>Then I need to select the max value and corresponding 'count_var'</li>
  </ol>
  
  <pre><code>    SELECT MAX(mycount) as mode
      FROM (SELECT COUNT(*) as mycount, count_var
            FROM test
            GROUP BY count_var) as t;
  </code></pre>
  
  <p>Have the result</p>
  
  <pre><code> mode 
  ------
   3
  </code></pre>
  
  <p>What I need at first? The result like</p>
  
  <pre><code> mode | count_var
  ------+----------
   3    |     15
  </code></pre>
  
  <p>Then I need to insert this result at another table to the field with type integer[]. </p>
  
  <p>The inserting result should be {3,15}</p>
  
  <p>How can I do this?</p>