pg.ddx.io  pgsql-sql@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Tomasz Myrta <jasiek@klaster.net>
To: Russell Shaw <rjshaw@iprimus.com.au>
To: Lista dyskusyjna pgsql-sql <pgsql-sql@postgresql.org>
Subject: Re: Outer join
Date: Tue, 03 Feb 2004 07:35:23 +0100
Message-ID: <401F412B.5090802@klaster.net> (raw)
In-Reply-To: <401F3F7F.7020802@iprimus.com.au>
References: <401F3F7F.7020802@iprimus.com.au>

Dnia 2004-02-03 07:28, Użytkownik Russell Shaw napisał:
> Hi,
> I'm using postgresql 7.3.4 on debian. I get bad results
> from a two-table left outer join.
> 
> First table: select * from descriptions;
> 
>    desc_id | description
>   ---------+-------------
>     909097 | cap
>     107890 | resis
>     223940 | ic
>     447652 | electro
>   (4 rows)
> 
> 
> Second table: select * from parts;
> 
>    part_id | desc_id | mounting | man_id
>   ---------+---------+----------+--------
>          2 |  107890 | SMD      |      7
>          1 |  909097 | LEADED   |      1
>          3 |  223940 | LEADED   |      8
>   (3 rows)
> 
> 
> Join:
> SELECT parts.*, d.description, d.desc_id FROM parts p LEFT OUTER JOIN 
^^^^^^^^^^^^^^^
You can't access "parts" here - you used table alias, so the only way to 
access it is using "p.*"
> descriptions d ON p.desc_id=d.desc_id;
> 
>   NOTICE:  Adding missing FROM-clause entry for table "parts"

Rewrite your query and show your results.

Regards,
Tomasz Myrta



view thread (7+ messages)  latest in thread

Message-ID: <401F412B.5090802@klaster.net>
Permalink:  ../401F412B.5090802@klaster.net/
Also on:    postgresql.org/message-id/401F412B.5090802@klaster.net

 · 

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: jasiek@klaster.net, rjshaw@iprimus.com.au
  Subject: Re: Outer join
  In-Reply-To: <401F412B.5090802@klaster.net>

* 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