Snowflake Vs MS-SQL - Part 74 - Convert Column Into Comma Separated

         



Convert Column Into Comma-Separated

If you have data in a table and you want to convert columnar data into a comma-separated string.

Current Data:


Expected Data:


MS-SQL Server 

We can achieve it by anyone approaching below:



However, in Snowflake, we can use two ARRAY functions, ARRAY_AGG & ARRAY_TO_STRING, as below:




For more details, you can refer to: ARRAY_AGG & 
ARRAY_TO_STRING.


Comments

Popular posts from this blog

Snowflake Vs MS-SQL - Part 63 - ON Clause & Cross Join

Snowflake Vs MS-SQL - Part 33 - INITCAP

Snowflake Vs MS-SQL - Part 70 - UNION By Name