title: how to achieve concatenation using group by
body: <p>Suppose there is a table named 'a' with following data:</p>
  
  <pre><code>col1, col2
  -----------
  1     1
  1     2
  1     3
  2     2
  2     3
  3     4
  </code></pre>
  
  <p>then to achieve following results:</p>
  
  <pre><code>col1, col2
  --------------
  1     6
  2     5
  3     4
  </code></pre>
  
  <p>i can run query like :</p>
  
  <p>select col1, sum(col2) from a group by col1.</p>
  
  <p>But suppose my table is:</p>
  
  <pre><code>col1, col2
  ---------
  1     a
  1     b 
  1     c
  2     d
  2     e
  3     f
  </code></pre>
  
  <p>here col2 is of varchar type not of numeric type.</p>
  
  <p>what will be the sql query to give following results???</p>
  
  <pre><code>col1,  col2
  ------------
  1     a,b,c
  2     d,e
  3     f
  </code></pre>
  
  <p>i have tried group by on col1 but how to concatenate values in col2???</p>
  
  <p>the problem is that col2 is of varchar type.</p>