Re: LEFT OUTER JOIN problem

From: Stephan Szabo <sszabo(at)megazone23(dot)bigpanda(dot)com>
To: xfinstrl(at)fi(dot)muni(dot)cz
Cc: pgsql-sql(at)postgresql(dot)org
Subject: Re: LEFT OUTER JOIN problem
Date: 2001-09-27 17:49:14
Message-ID: Pine.BSF.4.21.0109271048280.21569-100000@megazone23.bigpanda.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-sql


On Fri, 21 Sep 2001, Ludek Finstrle wrote:

> Hello,
>
> I have this problem (maybe only in my head ;o)):
>
> table1:
> -------
> id | name
> ---------
> 1 | 'blabla'
> 2 | 'arrrgh'
>
> table2:
> -------
> id | table1_id | name
> ---------------------
> 1 | 1 | 'hello'
>
> table3:
> -------
> id | table2_id | name
> ---------------------
>
> SELECT * FROM table1 LEFT OUTER JOIN table2 ON (table1.id = table2.table1_id)
> LEFT OUTER JOIN table3 ON (table2.id = table3.table2_id);
>
> This select return me only one row:
> 1,'blabla',1,1,'hello',NULL,NULL,NULL
>
> But I think it may return two rows:
> 1,'blabla',1,1,'hello',NULL,NULL,NULL
> 2,'arrrgh',NULL,NULL,NULL,NULL,NULL,NULL
>
> Where is the problem (in my head or in postgres)? Do you know what select
> statement return me what I want?

What version are you using? On 7.2 devel I get the two row result.

In response to

Browse pgsql-sql by date

  From Date Subject
Next Message Esteban Gutierrez Abarzua 2001-09-27 18:13:49 simple question!
Previous Message Tom Lane 2001-09-27 17:31:52 Re: Aggregate Aggravation