Re: Should be easy enough to get this result (or is it possible?)...

Поиск
Список
Период
Сортировка
От Tom Lane
Тема Re: Should be easy enough to get this result (or is it possible?)...
Дата
Msg-id 678.1021524300@sss.pgh.pa.us
обсуждение исходный текст
Ответ на Should be easy enough to get this result (or is it possible?)...  (Sean Chittenden <sean@chittenden.org>)
Список pgsql-general
Sean Chittenden <sean@chittenden.org> writes:
> The upshot of things being that I want the 2nd query below (f.foo =3D
> 'b') to return foo_id and foo.  Am I missing something?

I'm not real clear on what you're after, but the query results look
correct.  The LEFT JOIN result (without any WHERE restriction) is

test=# SELECT f.foo_id, f.foo, b.bar_id, b.bar
test-# FROM foo AS f LEFT JOIN bar AS b on (f.foo_id = b.foo_id);
 foo_id | foo | bar_id | bar
--------+-----+--------+-----
      1 | a   |      2 | y
      1 | a   |      1 | x
      1 | a   |      3 | z
      2 | b   |      4 | x
      2 | b   |      5 | z
      3 | c   |        |
(6 rows)

and so the restricted outputs with the WHERE clauses look right.
What were you trying to do exactly?

            regards, tom lane

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

Предыдущее
От: Tom Lane
Дата:
Сообщение: Re: Force a merge join?
Следующее
От: Lincoln Yeoh
Дата:
Сообщение: Re: Force a merge join?