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
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
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
Replies
Know the answer? Post it — somebody with the same question will find it here.