pg.ddx.io pgsql-sql@postgresql.org mailing list archive
help / color / mirror / Atom feedQuery two database at once
2+ messages / 2 participants
[nested] [flat]
* Query two database at once
@ 2005-05-02 15:36 Stéphane RIFF <stephane.riff@cerene.fr>
2005-05-02 17:51 ` Re: [despammed] Query two database at once Andreas Kretschmer <akretschmer@despammed.com>
0 siblings, 1 reply; 2+ messages in thread
From: Stéphane RIFF @ 2005-05-02 15:36 UTC (permalink / raw)
To: pgsql-sql
Hi,
I want to ewecute a query on two database like this :
SELECT * FROM table01 T1, table02 T2 WHERE T1.gid=T2.gid AND
T2.my_field='".$value."'
The problem is that table01 is in a different database than table02 and
i don't know how to telle postgresql
to look in two db.
Is there a solution other than execute two query ?
Thanks
^ permalink raw reply [nested|flat] 2+ messages in thread
* Re: [despammed] Query two database at once
2005-05-02 15:36 Query two database at once Stéphane RIFF <stephane.riff@cerene.fr>
@ 2005-05-02 17:51 ` Andreas Kretschmer <akretschmer@despammed.com>
0 siblings, 0 replies; 2+ messages in thread
From: Andreas Kretschmer @ 2005-05-02 17:51 UTC (permalink / raw)
To: pgsql-sql
am 02.05.2005, um 17:36:05 +0200 mailte Stéphane RIFF folgendes:
> Hi,
>
> I want to ewecute a query on two database like this :
>
> SELECT * FROM table01 T1, table02 T2 WHERE T1.gid=T2.gid AND
> T2.my_field='".$value."'
>
> The problem is that table01 is in a different database than table02 and i
> don't know how to telle postgresql
> to look in two db.
> Is there a solution other than execute two query ?
The answer is: yes and no.
No: PG can't connect to two databases and do a select across.
Yes: take a look at the contrib on dblink.
You should look in the archiv of the list, Tom Lane and other people
described the way with dblink in the past.
Andreas
--
Andreas Kretschmer (Kontakt: siehe Header)
Heynitz: 035242/47212, D1: 0160/7141639
GnuPG-ID 0x3FFF606C http://wwwkeys.de.pgp.net
=== Schollglas Unternehmensgruppe ===
^ permalink raw reply [nested|flat] 2+ messages in thread
end of thread, other threads:[~2005-05-02 17:51 UTC | newest]
Thread overview: 2+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2005-05-02 15:36 Query two database at once Stéphane RIFF <stephane.riff@cerene.fr>
2005-05-02 17:51 ` Andreas Kretschmer <akretschmer@despammed.com>
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox