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.

 All Forums
 General SQL Server Forums
 New to SQL Server Programming
 db to xml

Author  Topic 

laailalalaa
Yak Posting Veteran

57 Posts

Posted - 2009-12-02 : 03:55:13
hi,

i have tables t1(t1_id, t2_id1, t2_id2) and t2(t2_id, t2_name), with t2_id1 and t2_id2 being foreign keys for t2_id.

i want to display data from these tables in an xml file as follows:

<t1_id>
<t2_id1>t2_name</t2_id1>
<t2_id2>t2_name</t2_id2>
</t1_id>

if i perform a: join on t1.t2_id1 = t2.t2_id or t1.t2_id2 = t2.t2_id it will duplicate rows if both t2_id1 and t2_id2 are in t2 table and i don't want that.

[of course the tables are much more complicated so i am not allowed to make any changes to their design.]

any idea on how to write a query, view to do this?

thanks

visakh16
Very Important crosS Applying yaK Herder

52326 Posts

Posted - 2009-12-10 : 14:06:56
are you using sql 2005?
Go to Top of Page
   

- Advertisement -