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

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Sean Chittenden <sean(at)chittenden(dot)org>
Cc: pgsql-general(at)postgresql(dot)org
Subject: Re: Should be easy enough to get this result (or is it possible?)...
Date: 2002-05-16 04:45:00
Message-ID: 678.1021524300@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

Sean Chittenden <sean(at)chittenden(dot)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

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Lincoln Yeoh 2002-05-16 05:01:43 Re: Force a merge join?
Previous Message Tom Lane 2002-05-16 04:24:21 Re: Force a merge join?