Re: Slightly OT: outer joins

Поиск
Список
Период
Сортировка
От Fran Fabrizio
Тема Re: Slightly OT: outer joins
Дата
Msg-id 3BFAC481.B693083@mmrd.com
обсуждение исходный текст
Ответ на Slightly OT: outer joins  (Fran Fabrizio <ffabrizio@mmrd.com>)
Список pgsql-general
Thanks everyone for the replies and instruction.

I agree that there are better ways to layout the tables, but I'm sort of the guy
who gets handed the crappy poker hand while it's owner goes to the restroom and
is expected to make it a winner. :-)  In other words, I really can't lay out the
tables the way I would've wanted to.

So, within those contraints Randal hit it right on the nose.  I was definitely
not catching on enough to see that the 'NATURAL' option to the joins is an
obvious choice, which was part/all of my problem.  Thanks Randal and everyone!

-Fran

"Randal L. Schwartz" wrote:

> Got it on the first try:
>
> test=# select * from people natural left join color natural left join food;
>  id | fname | lname  | color | favorite_food
> ----+-------+--------+-------+---------------
>   1 | bob   | smith  | red   |
>   2 | tom   | jones  |       | eggrolls
>   3 | jane  | doe    | blue  | ice cream
>   4 | mike  | porter |       |
> (4 rows)
>
> That's presuming "id" matches "id" in each table, thus the easy
> use of the "natural" keyword.  The "left join" is what gives you
> nulls on the right.


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

Предыдущее
От: "Robert J. Sanford, Jr."
Дата:
Сообщение: Re: A newbie's opinion - postgres NEEDS a Windows binary!
Следующее
От: Peter Losher
Дата:
Сообщение: Re: Compiling v7.1.3 w/OpenSSL and Krb5 support...