Using Snowflake, In the example below, I am trying to concatenate all the city values found on any row for each employee and display them all (Concatenated) for each row where the user appears.
Example I have the table below:
| employee | city | color |
|---|---|---|
| john | montreal | blue |
| john | new york | yellow |
| john | yukon | red |
| mark | san francisco | orange |
| mark | baltimore | purple |
| ivan | london | black |
But my Expected result is the one below:
| employee | city | color |
|---|---|---|
| john | montreal ,new york ,yukon | blue |
| john | montreal ,new york ,yukon | yellow |
| john | montreal ,new york ,yukon | red |
| mark | san francisco,baltimore | orange |
| mark | san francisco,baltimore | purple |
| ivan | london | black |
Is there a snowflake query that could help me achieve this?
Thank you