I Have a Table with 3 fields ID,name, city, for generating xml for mentioned fields, i have written query like below
select ID,name,city from Table For XML RAW('IDS'),elements,root('Cities'),
for the above i m getting output as follows
<Cities>
<IDS>
<ID> 1 </ID>
<name> name1 </name>
<city> city1 </city>
</IDS>
</Cities>
The Above output is fine but now the question is i have assigned particular ID for particular city and the cities under same Id Must be in single element
i Mean i Want output as below
<Cities>
<IDS>
<ID1>
<name> name1 </name>
<city> city1 </city>
<name> name2 </name>
<city> city2 </city>
<name> name3 </name>
<city> city </city>
</ID1>
</IDS>
</Cities>
The name1,name2,name3 and city1,city2,city3 are belonging toThe ID1 can anybody help me get the output as above please.....
Thanks In Advance