Site Sponsored By: SQLDSC - SQL Server Desired State Configuration
Please start any new threads on our new
site at https://forums.sqlteam.com. We've got lots of great SQL Server
experts to answer whatever question you can come up with.
Dear All I want to union two select statements with for xml path.Is it possible.I want to display data from both tables using union and display it.Any one please helpEgselect g.groupname,NULL,NULL,NULL,NULLfrom groups g for xml path(''),TypeUNION SELECT Name,Terminal,Code,NULL,CityNamefrom NAME nfor xml path(''),TypeThankssri
blindman
Master Smack Fu Yak Hacker
2365 Posts
Posted - 2008-07-02 : 12:22:37
Would this work?:
select groupname, A, B, C, Dfrom --subquery (select g.groupname,NULL as A,NULL as B,NULL as C,NULL as D from groups g UNION SELECT Name,Terminal,Code,NULL,CityName from NAME n) subqueryfor xml path(''),Type
e4 d5 xd5 Nf6
visakh16
Very Important crosS Applying yaK Herder
52326 Posts
Posted - 2008-07-02 : 13:48:40
quote:Originally posted by csri Dear All Can anyone tell me how to do this.Struggling since 5 hours. Thankssri
can you show how xml node should appear and also some sample data from your tables?
visakh16
Very Important crosS Applying yaK Herder
52326 Posts
Posted - 2008-07-02 : 14:24:38
you want to repeat both group names with all detail?