Re: Slightly OT: outer joins

Поиск
Список
Период
Сортировка
От merlyn@stonehenge.com (Randal L. Schwartz)
Тема Re: Slightly OT: outer joins
Дата
Msg-id m11yisufaz.fsf@halfdome.holdit.com
обсуждение исходный текст
Ответ на Re: Slightly OT: outer joins  (Fran Fabrizio <ffabrizio@mmrd.com>)
Список pgsql-general
>>>>> "Fran" == Fran Fabrizio <ffabrizio@mmrd.com> writes:

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

[..]

>> test=# select * from people natural left join color natural left join food;

Well, even without the natural part of the join, let's presume
that people.id needed to be matched to color.people_id,
you could say that as:

select id, fname, lname, color, favorite_food from
  people
  left join color on people.id = color.people_id
  left join food on people.id = food.people_id

So the main clue wasn't the NATURAL, it was the LEFT JOIN, to give you
the nulls for the table rows that didn't match.

--
Randal L. Schwartz - Stonehenge Consulting Services, Inc. - +1 503 777 0095
<merlyn@stonehenge.com> <URL:http://www.stonehenge.com/merlyn/>
Perl/Unix/security consulting, Technical writing, Comedy, etc. etc.
See PerlTraining.Stonehenge.com for onsite and open-enrollment Perl training!

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

Предыдущее
От: "Gurunandan R. Bhat"
Дата:
Сообщение: Default conversion of type numeric to text in 7.1.3
Следующее
От: J Smith
Дата:
Сообщение: Re: PG vs MySQL