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

Join databases Query in SQL

Status
Not open for further replies.

mentasses

Technical User
Mar 23, 2004
29
GB
I have two databases, EMPLOYEES and VEHICLES

I want to run a SELECT query using tables from each database. I have tried using the full address to each table but this does not work.
e.g.
SELECT employee.details.surname,
vehicles.companycars.model
FROM employee.details INNER JOIN vehicles.companycars
ON vehicles.companycars.regno = employee.details.regno

Can anyone tell me where I am going wrong?



 
specify the name of database user ('dbo') in the query

For example:

Try below one

SELECT a.surname,
b.model
FROM employee.dbo.details a INNER JOIN vehicles.dbo.companycars b
ON a.regno = b.regno
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top