Re: LEFT OUTER JOIN question

Поиск
Список
Период
Сортировка
От Craig Ringer
Тема Re: LEFT OUTER JOIN question
Дата
Msg-id 481DE6F8.7000006@postnewspapers.com.au
обсуждение исходный текст
Ответ на LEFT OUTER JOIN question  ("seiliki" <seiliki@so-net.net.tw>)
Ответы Re: LEFT OUTER JOIN question
Список pgsql-sql
seiliki wrote:
> Hi!
> 
> I expect the SELECT to return two rows. Would some kind 
> soul explain for me why it gives only one row?

Without having read the post in detail I'll make a guess: Because NULL =
NULL results in NULL, not true, and the outer (or any other) join
condition only accepts rows where the join condition is true.

This is a FAQ. It probably needs to go in the PostgreSQL FAQ.

The usual response is: Rethink your use of NULL values. Null really
means "unknown" and if you're comparing for equality you probably don't
really want NULLs to be present. If you absolutely must perform
comparisons where NULL should be considered equal to NULL use `IS
DISTINCT FROM` ... but as everybody here says, use of that often
suggests design problems in your queries and schema.

--
Craig Ringer



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

Предыдущее
От: "seiliki"
Дата:
Сообщение: LEFT OUTER JOIN question
Следующее
От: "Aaron Bono"
Дата:
Сообщение: Re: LEFT OUTER JOIN question