Received: from maia.hub.org (unknown [200.46.208.211]) by mail.postgresql.org (Postfix) with ESMTP id B1870633035 for ; Fri, 12 Feb 2010 07:15:07 -0400 (AST) Received: from mail.postgresql.org ([200.46.204.86]) by maia.hub.org (mx1.hub.org [200.46.208.211]) (amavisd-maia, port 10024) with ESMTP id 00471-10 for ; Fri, 12 Feb 2010 11:14:33 +0000 (UTC) X-Greylist: from auto-whitelisted by SQLgrey-1.7.6 Received: from sargon.lncsa.com (mail.lncsa.com [213.215.28.11]) by mail.postgresql.org (Postfix) with ESMTP id 0DFF7632F50 for ; Fri, 12 Feb 2010 07:14:56 -0400 (AST) Received: from localhost (localhost.localdomain [127.0.0.1]) by sargon.lncsa.com (Postfix) with ESMTP id 188E0300CF0A for ; Fri, 12 Feb 2010 12:14:54 +0100 (CET) X-Virus-Scanned: Debian amavisd-new at lncsa.com Received: from sargon.lncsa.com ([127.0.0.1]) by localhost (sargon.lncsa.com [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id PTF1egpjW5Cl for ; Fri, 12 Feb 2010 12:14:54 +0100 (CET) Received: from zenon.apartia.fr (zenon.apartia.fr [10.0.3.1]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (Client CN "zenon.apartia.fr", Issuer "ca.apartia.fr" (verified OK)) by sargon.lncsa.com (Postfix) with ESMTP id EEC98300CF07 for ; Fri, 12 Feb 2010 12:14:53 +0100 (CET) Received: from galba.apartia.fr (galba.apartia.fr [10.0.3.119]) by zenon.apartia.fr (Postfix) with ESMTP id 9890B589A072B for ; Fri, 12 Feb 2010 12:14:53 +0100 (CET) Received: by galba.apartia.fr (Postfix, from userid 1000) id 7C325A3823; Fri, 12 Feb 2010 12:14:53 +0100 (CET) Date: Fri, 12 Feb 2010 12:14:53 +0100 From: Louis-David Mitterrand To: pgsql-sql@postgresql.org Subject: "left join" not working? Message-ID: <20100212111453.GA16318@apartia.fr> Mail-Followup-To: pgsql-sql@postgresql.org MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline User-Agent: Mutt/1.5.20 (2009-06-14) X-Virus-Scanned: Maia Mailguard 1.0.1 X-Spam-Status: No, hits=-2.289 tagged_above=-10 required=5 tests=AWL=0.310, BAYES_00=-2.599 X-Spam-Level: X-Archive-Number: 201002/43 X-Sequence-Number: 33642 Hi, This query: select c.id_currency,max(p.modified_on) from currency c left join price_line p using (id_currency) where p.id_line=1 group by c.id_currency; doesn't list all c.id_currency's, only those with a price_line. However this one does: select c.id_currency,max(p.modified_on) from currency c left join price_line p on (p.id_currency = c.id_currency and p.id_line=1) group by c.id_currency; How come? Thanks,