我有以下情况。我使用Union all
来构建XML。第一个查询的结果被视为第二个select语句的父标记。我的查询如下所示。对此有什么解决方法?
SELECT '<MasterRecordsXML>'
SELECT distinct
1 AS TAG
,NULL AS parent
,d AS [item!1!id]
,c AS [item!1!dsc]
from Table1
Union all
SELECT distinct
2 AS TAG
,1 AS parent
,d AS [item!1!id]
,c AS [item!1!dsc]
from Table2