In some situations we may need the data in another table should get as a single row in that situations we can follow like this....
Tag: convert, many rows, one row, path, select, single, single row, Sql server, xml
Select * From Customers 
Select * From Hobbies
Select * From CustomerHobbies
Select CustomerID,CustomerName,'Features'=
 (Select HobbyDesc+', ' From Hobbies Where HobbyID in 
  (Select HobbyID From CustomerHobbies Where CustomerID=Customers.CustomerID)
 For XML PATH(''))  From Customers 
Tag: convert, many rows, one row, path, select, single, single row, Sql server, xml




 
 
 
 
No comments:
Post a Comment