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.
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 IDthe requirment is to join the two tables and make a single tablewhen 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 columnExample:A.ID B.ID 10053940 NULLNULL 10053943NULL 10053943into ID100539401005394310053943ThanksVasu |
|
nr
SQLTeam MVY
12543 Posts |
Posted - 2006-05-14 : 14:58:12
|
select ID from Aunion allselect 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. |
 |
|
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. |
 |
|
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 |
 |
|
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 |
 |
|
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 bon a.ID = b.ID KH |
 |
|
|
|
|