I want the following query to return the fields in a parent child format. Is this possible?
Here's the query
SELECT Field1,
Field2,
Field3
FROM ATable
GROUP BY Field1,
Field2,
Field3
ORDER BY Field1,
Field2,
Field3
FOR xml auto
Here's what I would like to get back (doesn't have to be exaxtly like this, I just need the hierarchy.) I cant seem to get the rest of the xml displayed but this is most of it.
<Field1 Value='1'>
<Field2 Value='1'>
<Field3 Value='2'>
</Field2>
<Field2 Value='2'/>
<Field2 Value='3'/>
<Field1/>
<Field1 Value='2'>
<Field2 Value='1'>
<Field3 Value='2'>
</Field2>
<Field2 Value='2'/>
<Field2 Value='3'/>
<Field1/>