title: How to Concatenate 2 Columns using SQL in DBeaver connected to Redshift
body: <p>Here's an example table:</p>
  <pre><code> account_no     season      animal 
        A         spring      sheep
        A         spring      cow
        A         winter      pig
        B         winter      lamb
  </code></pre>
  <p>I'm using DBeaver connected to Redshift and I'd like to GROUP BY <strong>account_no</strong> and <strong>season</strong> and concatenate the animals into a single column as shown below:</p>
  <pre><code>account_no      season     animalList 
       A          spring     sheep, cow
       A          winter     pig   
       B          winter     lamb         
  </code></pre>
  <p>I've tried the <strong>STRING_AGG</strong> function such as</p>
  <pre><code>SELECT STRING_AGG(animal,',') AS animalList
  FROM Animals
  GROUP BY account_no, season
  </code></pre>
  <p>However, I'm getting the error below:</p>
  <pre><code>Error occurred during SQL query execution
  
  Reason: SQL Error [500310] [42883]: [Amazon](500310) Invalid operation: function string_agg(character varying, &quot;unknown&quot;) does not exist;
  </code></pre>
  <p>I've tried adding varchar as suggested by other threads but I'm still getting the same error</p>
  <pre><code> SELECT STRING_AGG(animal: : varchar,',') AS animalList
      FROM Animals
      GROUP BY account_no, season
  </code></pre>
  <p>Appreciate your help!</p>