Skip to content
Advertisement

SQL Concatenate all values in column B that have same value in column A for all values in column A

I am running PostgreSQL 12.4. I have a relatively large table like the following where column 1 and 2 are both of character varying type:

I would like to create something like the following:

Is there an easy way to do this?

Advertisement

Answer

You can use string_agg:

You can find more info here.

User contributions licensed under: CC BY-SA
6 People found this is helpful
Advertisement