Subject RE: [firebird-support] Multidatabase query
Author Gustavo
I suspected it was impossible to do this "cross database" query. I finally did something like you suggested.

Does anybody know if there are plans to make possible a query like this in future versions of FireBird?

Gustavo

----- Mensaje original -----
De: Woody (TMW)
Para: firebird-support@yahoogroups.com
Enviado: Martes, 10 de Mayo de 2005 13:15
Asunto: Re: [firebird-support] Multidatabase query


From: "Gustavo" <gusm@...>
>Hello:
>
>Suppose I have two databases named Database1 and Database2. In Database1
there is a >table named Table1 with fields Field11 and Field12 and in
Database2 there is a table >named Table2 with fields Field21 and Field22.
The question is:
>
>Is it possible to make a multidatabase query like the following?
>
>SELECT Table1.*, Table2.Field22
>FROM Database1.Table1, Database2.Table2
>WHERE (Table1.Field11 = Table2.Field21)
>
>I'm using Delphi 5 and IBX. I use the TQuery component but in its property
Database I can >assign only one database.
>
>If it´s impossible to do this with Firebird... Does anybody have any idea
of how can I obtain >my query in another way?

IMO, your best bet is to create a query returning the records you need from
the first database. Then, create a query on the second database using the
field from the first as a parameter to the second. Essentially, you get a
master-detail relationship so that as you move the pointer in the first, the
second responds correctly. I don't know if there are plans to incorporate
cross database joins in future versions of FB but it can't be done at the
moment.

HTH

Woody (TMW)



++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

Visit http://firebird.sourceforge.net and click the Resources item
on the main (top) menu. Try Knowledgebase and FAQ links !

Also search the knowledgebases at http://www.ibphoenix.com

++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++




------------------------------------------------------------------------------
Yahoo! Groups Links

a.. To visit your group on the web, go to:
http://groups.yahoo.com/group/firebird-support/

b.. To unsubscribe from this group, send an email to:
firebird-support-unsubscribe@yahoogroups.com

c.. Your use of Yahoo! Groups is subject to the Yahoo! Terms of Service.




[Non-text portions of this message have been removed]