Postgresql concat

broken image
broken image

We achieve this by utilizing the array_to_string and array_agg functions in PostgreSQL. We can select single as well as multiple columns with the array_agg function.

broken image

Select: This operation selects the column value to concatenate using the array_to_string and array_agg functions in PostgreSQL.

broken image

Select name_of_column1, name_of_column2, name_of_column3, …., name_of_columnN array_to_string (array_agg (name_of_column), “Value separator”) from name_of_table JOIN condition Group by condition

broken image