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)
 Merging Data from two tables

Author  Topic 

kaff
Starting Member

11 Posts

Posted - 2006-01-19 : 01:53:46
Hi,

I have two identical tables in two differant databases.

I need to get the unioun of those tables.

Only on One column.

Like

Database1.Table1.Col1 union database2.Table1.col1

Any help?

Thanks in Advance



Kaff

khtan
In (Som, Ni, Yak)

17689 Posts

Posted - 2006-01-19 : 01:55:13
[code]select Col1 from Database1.Table1
union all
select Col1 from Database2.Table1[/code]

-----------------
'KH'

Go to Top of Page

kaff
Starting Member

11 Posts

Posted - 2006-01-19 : 02:20:38
Thanks KH..
Can we have Order by clause on that column?


Kaff
Go to Top of Page

khtan
In (Som, Ni, Yak)

17689 Posts

Posted - 2006-01-19 : 02:27:59
yes. you can
select Col1 from Database1.Table1
union all
select Col1 from Database2.Table1
order by Col1


-----------------
'KH'

Go to Top of Page
   

- Advertisement -