Received: from maia.hub.org (unknown [200.46.204.183]) by mail.postgresql.org (Postfix) with ESMTP id 10B516338A4 for ; Wed, 21 Apr 2010 13:34:11 -0300 (ADT) Received: from mail.postgresql.org ([200.46.204.86]) by maia.hub.org (mx1.hub.org [200.46.204.183]) (amavisd-maia, port 10024) with ESMTP id 52449-01-10 for ; Wed, 21 Apr 2010 16:34:00 +0000 (UTC) X-Greylist: domain auto-whitelisted by SQLgrey-1.7.6 Received: from lo.gmane.org (lo.gmane.org [80.91.229.12]) by mail.postgresql.org (Postfix) with ESMTP id 9934D633BCF for ; Wed, 21 Apr 2010 13:33:26 -0300 (ADT) Received: from list by lo.gmane.org with local (Exim 4.69) (envelope-from ) id 1O4crZ-0000zt-GC for pgsql-sql@postgresql.org; Wed, 21 Apr 2010 18:33:21 +0200 Received: from srv.protecting.net ([212.126.218.242]) by main.gmane.org with esmtp (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Wed, 21 Apr 2010 18:33:21 +0200 Received: from hari.fuchs by srv.protecting.net with local (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Wed, 21 Apr 2010 18:33:21 +0200 X-Injected-Via-Gmane: http://gmane.org/ To: pgsql-sql@postgresql.org connect(): No such file or directory From: Harald Fuchs Subject: Re: LEFT OUTER JOIN issue Date: Wed, 21 Apr 2010 18:33:10 +0200 Lines: 18 Message-ID: References: <5AF59BAE41BBA14090A31CE077580C53238EAB6FDB@EXCHANGE2007.netcenter.local> <987929295D1345B5BCE249F42730CB82@marktestcr.marktest.pt> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Complaints-To: usenet@dough.gmane.org X-Gmane-NNTP-Posting-Host: srv.protecting.net X-Archive: encrypt User-Agent: Gnus/5.11 (Gnus v5.11) Emacs/22.2 (gnu/linux) Cancel-Lock: sha1:t+PSxdNAz9wFeB0wnToeUmJcrOM= X-Virus-Scanned: Maia Mailguard 1.0.1 X-Spam-Status: No, hits=0.801 tagged_above=-10 required=5 tests=BAYES_50=0.8, FREEMAIL_FROM=0.001, T_RP_MATCHES_RCVD=-0.01, T_TO_NO_BRKTS_FREEMAIL=0.01 X-Spam-Level: X-Archive-Number: 201004/82 X-Sequence-Number: 34009 In article <987929295D1345B5BCE249F42730CB82@marktestcr.marktest.pt>, "Oliveiros" 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.