pg.ddx.io  pgsql-sql@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Tom Lane <tgl@sss.pgh.pa.us>
To: Frank Joerdens <frank@joerdens.de>
Cc: pgsql-sql@postgresql.org
Cc: hank@fas-art.com
Cc: annette@fas-art.com
Subject: Re: Looking for the correct solution for a generic problem.
Date: Thu, 07 Feb 2002 16:50:53 -0500
Message-ID: <18832.1013118653@sss.pgh.pa.us> (raw)
In-Reply-To: <20020207215234.A6766@superfly.archi-me-des.de>
References: <20020207215234.A6766@superfly.archi-me-des.de>

Frank Joerdens <frank@joerdens.de> 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



view thread (5+ messages)  latest in thread

Message-ID: <18832.1013118653@sss.pgh.pa.us>
Permalink:  ../18832.1013118653@sss.pgh.pa.us/
Also on:    postgresql.org/message-id/18832.1013118653@sss.pgh.pa.us

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients using the --to and --cc options:
  reply via email

  To: pgsql-sql@postgresql.org
  Cc: tgl@sss.pgh.pa.us, frank@joerdens.de, hank@fas-art.com, annette@fas-art.com
  Subject: Re: Looking for the correct solution for a generic problem.
  In-Reply-To: <18832.1013118653@sss.pgh.pa.us>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

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