sql column values comma separated 1

sql column values comma separated

SELECT STRING_AGG(columnName,',') from tableName

Here is what the above code is Doing:
1. We are selecting the columnName from the tableName
2. We are using the STRING_AGG function to aggregate the columnName
3. We are using the comma as the delimiter
4. We are using the OVER() function to specify the partition
5. We are using the ORDER BY clause to specify the order of the columnName

Similar Posts