pg.ddx.io  pgsql-sql@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Ludek Finstrle <xfinstrl@informatics.muni.cz>
To: pgsql-sql@postgresql.org
Subject: LEFT OUTER JOIN problem
Date: Fri, 21 Sep 2001 15:32:00 +0200
Message-ID: <20010921153200.M19935@anxur.fi.muni.cz> (raw)

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?

Please reply to my address (xfinstrl@fi.muni.cz) as I'm not in list.

Thanks

Luf



view thread (3+ messages)  latest in thread

Message-ID: <20010921153200.M19935@anxur.fi.muni.cz>
Permalink:  ../20010921153200.M19935@anxur.fi.muni.cz/
Also on:    postgresql.org/message-id/20010921153200.M19935@anxur.fi.muni.cz

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients using the --to and --cc options:
  reply via email

  To: pgsql-sql@postgresql.org
  Cc: xfinstrl@informatics.muni.cz
  Subject: Re: LEFT OUTER JOIN problem
  In-Reply-To: <20010921153200.M19935@anxur.fi.muni.cz>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox