Received: from makus.postgresql.org (makus.postgresql.org [98.129.198.125]) by mail.postgresql.org (Postfix) with ESMTP id DD0631DA4C1F for ; Tue, 17 Jan 2012 12:28:02 -0400 (AST) Received: from lo.gmane.org ([80.91.229.12]) by makus.postgresql.org with esmtp (Exim 4.72) (envelope-from ) id 1RnBt6-0006kQ-Vo for pgsql-sql@postgresql.org; Tue, 17 Jan 2012 16:28:02 +0000 Received: from list by lo.gmane.org with local (Exim 4.69) (envelope-from ) id 1RnBss-00077p-TX for pgsql-sql@postgresql.org; Tue, 17 Jan 2012 17:27:42 +0100 Received: from 217.110.94.121 ([217.110.94.121]) by main.gmane.org with esmtp (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Tue, 17 Jan 2012 17:27:42 +0100 Received: from spam_eater by 217.110.94.121 with local (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Tue, 17 Jan 2012 17:27:42 +0100 X-Injected-Via-Gmane: http://gmane.org/ To: pgsql-sql@postgresql.org From: Thomas Kellerer Subject: Re: UPDATE COMPATIBILITY Date: Tue, 17 Jan 2012 17:28:40 +0100 Lines: 20 Message-ID: References: <201201170719.47830.adrian.klaver@gmail.com> Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit X-Complaints-To: usenet@dough.gmane.org X-Gmane-NNTP-Posting-Host: 217.110.94.121 User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.8.1.23) Gecko/20090812 Thunderbird/2.0.0.23 Mnenhy/0.7.6.666 In-Reply-To: <201201170719.47830.adrian.klaver@gmail.com> X-Pg-Spam-Score: -3.0 (---) X-Archive-Number: 201201/76 X-Sequence-Number: 36247 Adrian Klaver, 17.01.2012 16:19: >> You need to rewrite it to: >> >> UPDATE accounts >> SET contact_last_name = s.last_name, >> contact_first_name = s.first_name >> FROM salesmen s >> WHERE s.id = accounts.sales_id > > For completeness, you could also do: > > UPDATE accounts > SET (contact_last_name,contact_first_name)= > (s.last_name,s.first_name) > FROM salesmen s > WHERE s.id = accounts.sales_id > Nice one!