Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR SQL

postgresql concatenate multiple rows in group by

SELECT col_a,
array_to_string(array_agg(distinct col_b),',') AS Actor
FROM Table1
GROUP BY col_a;

-- Result:
-- MOVIE	ACTOR
-- A		1,2,3
-- B		4
Source by stackoverflow.com #
 
PREVIOUS NEXT
Tagged: #postgresql #concatenate #multiple #rows #group
ADD COMMENT
Topic
Name
8+5 =