in my sql table
| id | contents | |
| 1 | My content in first column | |
| 1 | My content in second column |
I want these two rows same id's 1 ,1 in a single row in sql , But not concate with comma seperation rather i want one line with line break then second line so they will appear in the row with line break .Please help.
i want them per requirement as below
| id | contents |
| 1 |
My content in first column My content in second column |
Jignesh KumarPosted Jun 11, 2021, 6:12 AM
Hi,
You can use stuff function or you are using SQL server 2017+ then you can use
STRING_AGG()function to achieve this stuff. Please find below reference thread,https://stackoverflow.com/questions/55129372/how-to-concatenate-rows-into-one-cell-and-add-break-line-after-each-one-using-sq