"left join" not working?

From: Louis-David Mitterrand <vindex+lists-pgsql-sql(at)apartia(dot)org>
To: pgsql-sql(at)postgresql(dot)org
Subject: "left join" not working?
Date: 2010-02-12 11:14:53
Message-ID: 20100212111453.GA16318@apartia.fr
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-sql

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,

Responses

Browse pgsql-sql by date

  From Date Subject
Next Message Oliveiros C, 2010-02-12 11:35:02 Re: "left join" not working?
Previous Message Jasen Betts 2010-02-11 11:05:38 Re: 'image' table with relationships to different objects