Received: from sss.pgh.pa.us ([192.204.191.242]) by postgresql.org (8.11.3/8.11.4) with ESMTP id g17LoxE28160 for ; Thu, 7 Feb 2002 16:50:59 -0500 (EST) (envelope-from tgl@sss.pgh.pa.us) Received: from sss2.sss.pgh.pa.us (tgl@localhost [127.0.0.1]) by sss.pgh.pa.us (8.11.4/8.11.4) with ESMTP id g17Lorf18835; Thu, 7 Feb 2002 16:50:53 -0500 (EST) To: Frank Joerdens cc: pgsql-sql@postgresql.org, hank@fas-art.com, annette@fas-art.com Subject: Re: Looking for the correct solution for a generic problem. In-reply-to: <20020207215234.A6766@superfly.archi-me-des.de> References: <20020207215234.A6766@superfly.archi-me-des.de> Comments: In-reply-to Frank Joerdens message dated "Thu, 07 Feb 2002 21:52:34 +0100" Date: Thu, 07 Feb 2002 16:50:53 -0500 Message-ID: <18832.1013118653@sss.pgh.pa.us> From: Tom Lane X-Archive-Number: 200202/85 X-Sequence-Number: 6514 Frank Joerdens writes: > This works fine if there is *at least* one row in B for each row in A. > If there isn't, I obviously get 0 results even if the column foo in A > matches the desired criteria. But I do want the rows from A even if > there is no row in B that is linked to those rows in A that match the > criteria. You want an "outer join". Something like FROM A LEFT JOIN B ON (A.id = B.a_id) WHERE [other criteria] regards, tom lane