Thursday, April 16, 2015

Postgres Bring row values of a column comma separated to primary key

Employee Master
id bigint
name text
department_id bigint


Department Master
id bigint
name text

Query
select userid,string_agg(gr.roledescription,',') from employee_master employee
INNER JOIN department_master dept ONemployee.department_id=dept.id

No comments: