update from and left join - Mailing list pgsql-sql

From Tomasz Myrta
Subject update from and left join
Date
Msg-id evi1du$2hiv$1@news.hub.org
Whole thread Raw
List pgsql-sql
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


pgsql-sql by date:

Previous
From: John Summerfield
Date:
Subject: Re: A long-running transaction
Next
From: Andrew Sullivan
Date:
Subject: Re: A long-running transaction