Generate xml element from Union of 2 Select queries
985031Jan 15 2013 — edited Jan 16 2013Do you know ho I can get the union result of 2 queries and put them in xml result, but I want each query to be in seperate xml element.
I don t want to put 1 single xmlelement and do a From then construct a virtual table uniting the 2 subqueries
I mean I don t want something like the following:
(Select
XMLAGG(
XMLELEMENT("credit",
XMLForest(field1 "detail")
)
)
FROM
(
--SubQuery1
Select field1 from myTable1
union
--SubQuery1
Select field1 from myTable2
)
) "credits"
I want something like here:
XMLELEMENT("credits",
(SELECT
XMLAGG(
XMLELEMENT("credit",
XMLForest(field1 "field1")
)
)
FROM
myTable1
),
(SELECT
XMLAGG(
XMLELEMENT("credit",
XMLForest(field1 "field1")
)
)
FROM
myTable2
)
)
Except the 2nd alternative is not working Sad
I get error message:
"SQL command not properly ended"
Thanks a lot