From: | Tomasz Myrta <jasiek(at)klaster(dot)net> |
---|---|
To: | Russell Shaw <rjshaw(at)iprimus(dot)com(dot)au>, Lista dyskusyjna pgsql-sql <pgsql-sql(at)postgresql(dot)org> |
Subject: | Re: Outer join |
Date: | 2004-02-03 06:35:23 |
Message-ID: | 401F412B.5090802@klaster.net |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-sql |
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
From | Date | Subject | |
---|---|---|---|
Next Message | Russell Shaw | 2004-02-03 06:44:13 | Re: Outer join |
Previous Message | Russell Shaw | 2004-02-03 06:28:15 | Outer join |