Can you query between two DBs

mattv10

Registered User.
Local time
Today, 16:30
Joined
Jul 24, 2006
Messages
20
Is it possible to write a query that will extract information from two databases???

If so can someone give me a little instruction on how to go about doing this..

Thanks in advance!
 
It's entirely possible to write a query that will extract information from two databases. Let's say you have two databases: C:\MyDb1.mdb and C:\MyDb2.mdb. MyDb1.mdb has a table, MyTable1, and MyDb2.mdb has a table, MyTable2. Both tables have a common field, (yep, you guessed it) MyField.

For this example, we are going to write a query that performs an inner join between the two tables in the two databases, joined by MyField, and displays the combined set of field data between the two tables. Below is the SQL:
Code:
SELECT T1.*, T2.*
FROM [;Database=C:\MyDb1.mdb].MyTable1 AS T1
INNER JOIN [;Database=C:\MyDb2.mdb].MyTable2 AS T2
ON T1.MyField=T2.MyField
 
You can also use linked tables if the databases are in a stationary position.
 

Users who are viewing this thread

Back
Top Bottom