Re: update syntax - Mailing list pgsql-sql

From Bruce Momjian
Subject Re: update syntax
Date
Msg-id 200201270037.g0R0bj706252@candle.pha.pa.us
Whole thread Raw
In response to update syntax  (chester c young <chestercyoung@yahoo.com>)
Responses Re: update syntax
List pgsql-sql
chester c young wrote:
> how in pgsql do you do Oracle's
> 
> update t1 set ( c2, c3 ) =
> ( select c2, c3 from t1 where t1.c1 = t2.c1 );

Well, because we have FROM in UPDATE:
UPDATE t1 SET c2 = t2.c2, c3 = t2.c3FROM t1 t2WHERE t1.c1 = t2.c1;

--  Bruce Momjian                        |  http://candle.pha.pa.us pgman@candle.pha.pa.us               |  (610)
853-3000+  If your life is a hard drive,     |  830 Blythe Avenue +  Christ can be your backup.        |  Drexel Hill,
Pennsylvania19026
 


pgsql-sql by date:

Previous
From: chester c young
Date:
Subject: update syntax
Next
From: Chris Ruprecht
Date:
Subject: Re: interval and timestamp change?