Re: Looking for the correct solution for a generic problem. - Mailing list pgsql-sql

From Tom Lane
Subject Re: Looking for the correct solution for a generic problem.
Date
Msg-id 18832.1013118653@sss.pgh.pa.us
Whole thread Raw
In response to Looking for the correct solution for a generic problem.  (Frank Joerdens <frank@joerdens.de>)
List pgsql-sql
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 likeFROM A LEFT JOIN B ON (A.id = B.a_id)WHERE [other criteria]
        regards, tom lane


pgsql-sql by date:

Previous
From: Stephan Szabo
Date:
Subject: Re: Looking for the correct solution for a generic problem.
Next
From: Frank Joerdens
Date:
Subject: Re: Looking for the correct solution for a generic problem.