Re: Select from multiple tables - Mailing list pgsql-general

From Jim C. Nasby
Subject Re: Select from multiple tables
Date
Msg-id 20030606193150.GH40542@flake.decibel.org
Whole thread Raw
In response to Select from multiple tables  (Jon Earle <je_pgsql@kronos.honk.org>)
List pgsql-general
On Fri, Jun 06, 2003 at 11:17:01AM -0400, Jon Earle wrote:
>
> Hi,
>
> I want to select data from two tables, with the keying information for the
> second table coming from the select results of the first.  Can this be
> done in one call, or will I need to resort to two calls - one to get the
> record from the first table, then a second call to get the record from the
> second table based on a key contained in the first results set?

SELECT * FROM table1 t1, table2 t2 WHERE t1.key_field = t2.key_field;
--
Jim C. Nasby (aka Decibel!)                    jim@nasby.net
Member: Triangle Fraternity, Sports Car Club of America
Give your computer some brain candy! www.distributed.net Team #1828

Windows: "Where do you want to go today?"
Linux: "Where do you want to go tomorrow?"
FreeBSD: "Are you guys coming, or what?"

pgsql-general by date:

Previous
From: Tom Lane
Date:
Subject: Re: server process segfaulting
Next
From: Jan Wieck
Date:
Subject: Re: update phenomenom