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
 Transact-SQL (2000)
 joining same field

Author  Topic 

u2p_inst
Yak Posting Veteran

78 Posts

Posted - 2003-05-11 : 04:23:20


I have 2 tables and each table have same name of field
Is it possible to joining same field in different table, if possible How?
table1: NameCode FullName
f312 Adrianus W

table2: NameCode FullName
M610 Dyan Know

the oytput needed is:

NameCode | FullName
f312 | Adrianus W
M610 | Dyan Know



oh

chadmat
The Chadinator

1974 Posts

Posted - 2003-05-11 : 05:02:28
This doesn't look like a join. Looks like you want a union.

select namecode, fullname
from table1
union
select namecode, fullname
from table2

-Chad


http://www.clrsoft.com

Software built for the Common Language Runtime.
Go to Top of Page

X002548
Not Just a Number

15586 Posts

Posted - 2003-05-12 : 12:58:54
and...if you want to know what table the data came from

select 'table1' as source, namecode, fullname
from table1
union
select 'table2' as source, namecode, fullname
from table2



Brett

8-)
Go to Top of Page
   

- Advertisement -