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
 SQL Server 2000 Forums
 Import/Export (DTS) and Replication (2000)
 full join two tables

Author  Topic 

vasu4us
Posting Yak Master

102 Posts

Posted - 2006-05-14 : 14:56:03
I have two tables which have payment type details one is check and the other is wire and the only common coloum in the two tables is ID
the requirment is to join the two tables and make a single table

when i make a full join iam geting all the details from the two tables but the primary key column ie ID is repeated once for each table
how can i get the details into a singlr column
Example:
A.ID B.ID
10053940 NULL
NULL 10053943
NULL 10053943

into
ID
10053940
10053943
10053943

Thanks
Vasu

nr
SQLTeam MVY

12543 Posts

Posted - 2006-05-14 : 14:58:12
select ID from A
union all
select ID from B


==========================================
Cursors are useful if you don't know sql.
DTS can be used in a similar way.
Beer is not cold and it isn't fizzy.
Go to Top of Page

vasu4us
Posting Yak Master

102 Posts

Posted - 2006-05-14 : 20:19:16
i can not use the union as the table structure is different for the 2 tables one is related to check details and the othere is related to wire transfer details. there can be only on entery in the either of the two tables reg to payment.
Go to Top of Page

Kristen
Test

22859 Posts

Posted - 2006-05-15 : 01:52:37
"i can not use the union as the table structure is different for the 2 tables"

You only indicated that you needed ID, and that will work with a UNION (if one is varchar and the other int then just CAST them to be of the same [LCD] type). What's the actual query you need?

Kristen
Go to Top of Page

khtan
In (Som, Ni, Yak)

17689 Posts

Posted - 2006-05-15 : 02:20:54
quote:
Originally posted by vasu4us

i can not use the union as the table structure is different for the 2 tables one is related to check details and the othere is related to wire transfer details. there can be only on entery in the either of the two tables reg to payment.


Post your 2 table structure, some sample data and the result that you want


KH

Go to Top of Page

khtan
In (Som, Ni, Yak)

17689 Posts

Posted - 2006-05-15 : 02:35:47
Or is this what you want ?
select coalesce(a.ID, b.ID) as ID, < other columns >
from tableA a full outer join tableB b
on a.ID = b.ID



KH

Go to Top of Page
   

- Advertisement -