Skip to content
Advertisement

Create new column with all unique values from another column in SQL

I have the following table:

I want tto create new table which will show the unique crop names, count of the crops appearence and then list of all the growers that grow this crop,so the result table should look like this:

I manage to create table that shows the crops and the total count without the growers names:

My question is how can I create new table with new column that contains list of unique growers for each crop (like in the example).

Advertisement

Answer

GROUP_CONCAT is for MySQL, Snowflake uses LISTAGG:

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