Re: Select from multiple tables

From: "Jim C(dot) Nasby" <jim(at)nasby(dot)net>
To: pgsql-general(at)postgresql(dot)org
Subject: Re: Select from multiple tables
Date: 2003-06-06 19:31:50
Message-ID: 20030606193150.GH40542@flake.decibel.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: 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(at)nasby(dot)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?"

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Steve Crawford 2003-06-06 19:52:19 Re: update phenomenom
Previous Message Jan Wieck 2003-06-06 19:30:36 Re: update phenomenom