title: Postgres Rederive the column
body: <p>I'm taking an reference from the link : <a href="https://stackoverflow.com/questions/61848881/postgres-to-fetch-the-list-having-comma-separated-values">Postgres to fetch the list having comma separated values</a>. just wanted to see if we can modify below query, if Employee has more than 1 email Id present, then 1 else 0. I want to have these 0 &amp; 1 value into separatw column,</p>
  
  <p>Can we do this ?</p>
  
  <pre><code>select c.*,
      string_agg(ce.email, ',') as emails
  from root.employee c
  full outer join root.employee_email ce
      on c.employee_id = ce.employee_id
  group by
      c.employee_id
  order by
      c.employee_id
  limit 1000
  offset 0;
  </code></pre>