Re: LEFT JOIN ...

Поиск
Список
Период
Сортировка
От Tom Lane
Тема Re: LEFT JOIN ...
Дата
Msg-id 8035.992894175@sss.pgh.pa.us
обсуждение исходный текст
Ответ на Re: LEFT JOIN ...  (The Hermit Hacker <scrappy@hub.org>)
Ответы Re: LEFT JOIN ...  (The Hermit Hacker <scrappy@hub.org>)
Список pgsql-sql
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


В списке pgsql-sql по дате отправления:

Предыдущее
От: The Hermit Hacker
Дата:
Сообщение: Re: Better Archives?
Следующее
От: "Joe Conway"
Дата:
Сообщение: Re: Subselects, the Oracle way