Re: LEFT OUTER JOIN issue

From: Harald Fuchs <hari(dot)fuchs(at)gmail(dot)com>
To: pgsql-sql(at)postgresql(dot)org
Subject: Re: LEFT OUTER JOIN issue
Date: 2010-04-21 16:33:10
Message-ID: puochcbwah.fsf@srv.protecting.net
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-sql

In article <987929295D1345B5BCE249F42730CB82(at)marktestcr(dot)marktest(dot)pt>,
"Oliveiros" <oliveiros(dot)cristina(at)marktest(dot)pt> writes:

> Hi, Thomas.
> I believe it is because of your WHERE clause, which is filtering out the nulls
> from hp table.

> According to

> WHERE

> hp.poste_idposte = 275

> You only want registers that have hp.poste_idposte = 275, not the null ones.

Yes, the WHERE effectively turns the outer into an inner join, thus
removing rows from the right table. By moving the WHERE to the JOIN
condition, you get the result you expected.

In response to

Browse pgsql-sql by date

  From Date Subject
Next Message Gonzalo Aguilar Delgado 2010-04-21 17:36:54 Re: Problem with insert related to different schemas
Previous Message Tom Lane 2010-04-21 15:23:12 Re: Problem with insert related to different schemas