Re: Select from multiple tables

From: Richard Huxton <dev(at)archonet(dot)com>
To: Jon Earle <je_pgsql(at)kronos(dot)honk(dot)org>, pgsql-general(at)postgresql(dot)org
Subject: Re: Select from multiple tables
Date: 2003-06-06 18:58:58
Message-ID: 200306061958.58817.dev@archonet.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

On Friday 06 Jun 2003 4:17 pm, 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?

A join?

SELECT * FROM tbl_a,tbl_b WHERE tbl_b.some_field=tbl_a.other_field;

Or have I got the wrong end of the stick here?
--
Richard Huxton

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Jamie Lawrence 2003-06-06 19:02:22 Re: Postmaster only takes 4-5% CPU
Previous Message Ernest E Vogelsinger 2003-06-06 18:37:44 Re: Select from multiple tables