Re: Update from select

From: Vincent Veyron <vv(dot)lists(at)wanadoo(dot)fr>
To: bret_stern(at)machinemanagement(dot)com
Cc: pgsql-general(at)postgresql(dot)org
Subject: Re: Update from select
Date: 2013-05-13 20:51:22
Message-ID: 1368478282.2563.54.camel@asus-1001PX.home
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

Le lundi 13 mai 2013 à 13:23 -0700, Bret Stern a écrit :
> PG 8.4
>
> Having trouble putting together an update query to update
> multiple columns in tbl1 from columns in tbl2.
>
> update tbl1
> set col3,col4,col5
> from
> (select col3, col4,col5 from tbl2 where col1="criteria")
>

UPDATE tbl1
SET col3=t2.col3, col4=t2.col4, col5=t2.col5
FROM tbl2 t2 WHERE t2.col1="criteria"

--
Salutations, Vincent Veyron
http://gdlc.fr/logiciels
Applications de gestion des sinistres assurance et des contentieux juridiques

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Alvaro Herrera 2013-05-13 21:00:20 Re: refactoring a database owner without "reassign owned"
Previous Message Jeff Janes 2013-05-13 20:49:17 Re: refactoring a database owner without "reassign owned"