Antw: Outer Joins

Поиск
Список
Период
Сортировка
От Gerhard Dieringer
Тема Antw: Outer Joins
Дата
Msg-id sa012c39.092@kopo001
обсуждение исходный текст
Список pgsql-sql
>>> "Marc Rohloff" <Marc.Rohloff@eskom.co.za> 01.11.2000  09.02 Uhr >>>
>
> select a.col1, b.col2 from a,b 
> where a.col1 = b.col2
>   or  b.col2 is null
>

This query has nothing to do with an outer join. See the following example:

table a

c1
---
x
y 

and 

table b

c2
---
x

Then an outer join gives:

select a,c1, b.c2
from a left outer join b on a.c1 = b.c2

c1 | c2
x  |  x
y  | (null)

but your query gives:

select a.c1, b.c2
from a, b 
where a.c1 = b.c2 or  b.c2 is null

c1 | c2
x  |  x

because there are no rows in table b with c2 is null

-------------
Gerhard




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

Предыдущее
От: "Marc Rohloff"
Дата:
Сообщение: Re: Outer Joins
Следующее
От: Tom Lane
Дата:
Сообщение: Re: Re: [GENERAL] Problem with coalesce..