FOR XML PATH in SQL
We use FOR XML PATH in sql to get comma separated values from tables have one to many relation.
For example we have two tables tblCategory and tblProduct
and one category can have multiple products. Now we want to get all products of
a category in comma separated in single columns then we can use FOR XML PATH
tblCategory
CategoryID
|
CategoryName
|
1
|
Electronics
|
2
|
Apparels
|
tblProduct

Join the conversation! Your thoughts help the community grow.