Обсуждение: newbie outer-join

Поиск
Список
Период
Сортировка

newbie outer-join

От
"Matlack, Brad"
Дата:
I'm trying to do what I think is an outer-join:

SELECT da.datname as database,de.description as comment
FROM pg_database as da,pg_description as de
WHERE 
(da.oid = de.objoid)

Obviously, if there are no descriptions, no values will be returned.
What I want is to display all databases, with comments (valid or null).

How do I form the WHERE clause?
Thanks,
Brad Matlack
matlackb@ogden.disa.mil




Re: [SQL] newbie outer-join

От
Peter Eisentraut
Дата:
On 1999-11-08, Matlack, Brad mentioned:

> I'm trying to do what I think is an outer-join:
> 
> SELECT 
>  da.datname as database,
>  de.description as comment
> FROM 
>  pg_database as da,
>  pg_description as de
> WHERE 
> (da.oid = de.objoid)
> 
> Obviously, if there are no descriptions, no values will be returned.
> What I want is to display all databases, with comments (valid or null).

SELECT datname, [...,] obj_description(pg_database.oid) FROM pg_database;

is a work-around. Outer joins will appear in the next release, so I hear.


-- 
Peter Eisentraut                  Sernanders vaeg 10:115
peter_e@gmx.net                   75262 Uppsala
http://yi.org/peter-e/            Sweden