On Fri, Jan 30, 2004 at 07:41:18 -0800,
  "Edwin S. Ramirez" <[EMAIL PROTECTED]> wrote:
> Hello,
> 
> I need Postgres support for the following update syntax :
> 
> update table1 set (col1, col2, col3) = (select f1, f2, f3 from table2
> where id=5) where rownum=3;
> 
> update table1 set (col1, col2, col3) = (select f1, f2, f3 from table2
> where id=table1.parentid) where rownum=3;
> 
> These type of update statements are the only ones supported by Oracle
> to update one table from another.

As a work around you could do:
update table1 set
  col1 = (select f1 from table2 where id=table1.parentid),
  col2 = (select f2 from table2 where id=table1.parentid),
  col3 = (select f3 from table2 where id=table1.parentid)
  where rownum=3;

I don't think this will run as efficiently and it makes the query look
more complex, but it should work for both Oracle and Postgres.

---------------------------(end of broadcast)---------------------------
TIP 6: Have you searched our list archives?

               http://archives.postgresql.org

Reply via email to