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 IamaSherpa on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Join between two databases

Status
Not open for further replies.

rgbanse

MIS
Jun 4, 2001
211
US
what is the SQL to do the following:
Database A contains table ItemNbr with fields
Item
Desc

Database B contains table ItemDetail with fields
Item
Plnr
User

I want to join Table A to B linking on Field Item
returning - Item, Desc, Plnr, User

thanks in advance
RGB
 
Hi:

If you are on the same server, running dbaccess from database a, adb, the select looks like this:

# tested
select a.item, a.desc, b.plnr, b.user from ItemNbr a, adb:ItemDetail b where a.item = b.item

where adb is the other database. If the database is on a different server:

# untested
select a.item, a.desc, b.plnr, b.user from ItemNbr a, adb@differentserver:ItemDetail b where a.item = b.item

Regards,

Ed
 
Hi Rgb,

If you are on the same server, but have multiple residency i.e., different instances of online database servers have been configured, then the select would look like:

Assuming Databse B is in different instance:

select a.item, a.desc, b.plnr, b.user from ItemNbr a, databaseB@databaseservername:ItemDetail b where a.item = b.item ;

I have tested this statement.

Regards,
Shriyan
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top