Board index » delphi » Querying Multiple databases in one Query

Querying Multiple databases in one Query

Using 2 or more databases e.g. DB1.gdb and DB2.gdb how can I write a query
that accesses tables in each database.

Something like...
Select d1.ID, d2.ID from
DB1.Table1 d1, DB2.Table1 d2

I need to be able to do this in DSQL.

I can access each database in turn, store the result set, access the next
one then do all the calculations required.

I would think there was a method in sql that would allow me to reference
tables in different databases.

Geoff

 

Re:Querying Multiple databases in one Query


Quote
igt wrote:

> Using 2 or more databases e.g. DB1.gdb and DB2.gdb how can I write a query
> that accesses tables in each database.

> Something like...
> Select d1.ID, d2.ID from
> DB1.Table1 d1, DB2.Table1 d2

> I need to be able to do this in DSQL.

> I can access each database in turn, store the result set, access the next
> one then do all the calculations required.

> I would think there was a method in sql that would allow me to reference
> tables in different databases.

No there isn't.  You can't do this with SQL and Interbase.  If you use the BDE
you can do a heterogeneous join, but not with the normal IB DB engine.

Quote
> Geoff

--
Jeff Overcash (TeamB)   | Talk about failure
(Please do not email    | To fall is not to fail
 me directly unless     | Failure isn't about falling down
 asked.  Thank You)     | Failure is staying down (Marillion)

Other Threads