1
我從同一個表中選擇2組列,如下所示。SQL Server 2005查詢XML數據類型相關
select (select a, b, c from T1 FOR XML RAW('CAT1')),
(select d, e, f from T1 FOR XML RAW('CAT2'))
for XML PATH('Parent')
查詢的結果是
<Parent><CAT1 a="Data1" b="Data2', c="Data3" ><CAT2 d="Data4" e="Data5" f="Data6"></Parent>
如何避免?我會得到一個適當的父母xml?
預期結果
<Parent>
<CAT1 a="Data1" b="Data2', c="Data3">
<CAT2 d="Data4" e="Data5" f="Data6">
</Parent>