hari-p
8/25/2015 - 5:11 AM

You can concatenate same column in postgres using group by function like the example below

You can concatenate same column in postgres using group by function like the example below

update content_description  set cross_curriculum_priorities = subquery.ccp
from (select  kw.code, string_agg(kw.mapped_ccp, ', ') as "ccp" from acc_keywords_tagging_import kw where uri like '%cross%' group by kw.code) as subquery
 WHERE subquery.code = content_description.ac_code
select  kw.code, string_agg(substring(kw.uri from  length(kw.uri) for length(kw.uri)), ',') as "ccp" 
from acc_keywords_tagging_import kw where uri like '%cross%' group by kw.code