Re: LEFT JOIN ... - Mailing list pgsql-sql

From The Hermit Hacker
Subject Re: LEFT JOIN ...
Date
Msg-id Pine.BSF.4.33.0106181716360.22744-100000@mobile.hub.org
Whole thread Raw
In response to Re: LEFT JOIN ...  (Tom Lane <tgl@sss.pgh.pa.us>)
List pgsql-sql
Perfect, thank you ... i knew I was overlooking something obvious ... the
query just flies now ...

On Mon, 18 Jun 2001, Tom Lane wrote:

> The Hermit Hacker <scrappy@hub.org> writes:
> >> Try adding ... AND n.nid = 15748 ...  to the WHERE.
>
> > n.nid is the note id ... nl.id is the contact id ...
>
> Ooops, I misread "n.nid = nl.nid" as "n.nid = nl.id".  Sorry for the
> bogus advice.
>
> Try rephrasing as
>
> FROM (note_links nl JOIN notes n ON (n.nid = nl.nid))
>      LEFT JOIN calendar c ON (n.nid = c.nid)
> WHERE ...
>
> The way you were writing it forced the LEFT JOIN to be done first,
> whereas what you want is for the note_links-to-notes join to be done
> first.  See
> http://www.ca.postgresql.org/users-lounge/docs/7.1/postgres/explicit-joins.html
>
>             regards, tom lane
>

Marc G. Fournier                   ICQ#7615664               IRC Nick: Scrappy
Systems Administrator @ hub.org
primary: scrappy@hub.org           secondary: scrappy@{freebsd|postgresql}.org



pgsql-sql by date:

Previous
From: "Joe Conway"
Date:
Subject: Re: Subselects, the Oracle way
Next
From: "Svenne Krap"
Date:
Subject: Re: Subselects, the Oracle way - slightly OT