From: Tomasz Myrta <jasiek@klaster.net>
To: pgsql-sql@postgresql.org
Subject: update from and left join
Date: Wed, 11 Apr 2007 09:06:46 +0200
Message-ID: <evi1du$2hiv$1@news.hub.org> (raw)
Hello
I have a query:
update A set...
from B left join C on (C.col1=B.col1 and C.col2=A.col2)
where ...
which gives me an error:
ERROR: invalid reference to FROM-clause entry for table "A"
HINT: There is an entry for table "A", but it cannot be referenced from
this part of the query.
I found two solutions:
- table A self join 1:1 in "from" part of query,
- table C subqueries in "where" clause - not too comfortable, because I
need col2 value several times.
Any other idea?
The database is PostgreSQL 8.1.5.
Regards,
Tomasz Myrta
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
Subject: Re: update from and left join
In-Reply-To: <evi1du$2hiv$1@news.hub.org>
* 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