select Idas [@Id], Nameas [@Name],
(select Child.Idas [@Id], Child.Nameas [@Name]
FromChild
where Child.ParentId = Parent.Idfor xml path('Child'), type) as [*]
fromParentfor xml path ('Parent'), root('Output')
1 comment
1 Comment
Join the conversation! Your thoughts help the community grow.
Join to leave a comment
Members earn 10 SHARP for a comment, 10 SHARP for a reaction, and 250 SHARP for every blog they publish.
Archana AcharyaPosted Jul 25, 2023, 2:50 PM EDT
Thank you for this!