Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Same query, multiple databases 2

Status
Not open for further replies.

Niv3k

Programmer
Jul 11, 2001
350
US
If I have a table of street address (STREET) in one database (LOCATIONS) and a table of hardware (EQUIPMENT) in another database (HARDWARE), is there anyway with SQL 2000 to run a query on the two tables? Let's assume the user is "dbo" and both fields are called "AddressID"

I thought this was possible, but I can't seem to get it to work. Both databases are on the same server...

Kevin
 
Try the following:

select a.AddressID as DB1_AddressID, b.AddressID as DB2_AddressID from
LOCATIONS..STREET a, HARDWARE..EQUIPMENT b
where a.AddressID = b.AddressID
 
Hi,

I use SQL-97, but this should work:
select *
from locations.dbo.street a
join hardware.dbo.equipment b
on a.addressid=b.addressid

 
Thank you both! I was trying
SELECT Hardware..Equipment.Piece, Locations..Street.Address
etc... and it just would not work. Now I know!

Kevin
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top