Skip site navigation (1) Skip section navigation (2)

Re: UPDATE COMPATIBILITY

From: Adrian Klaver <adrian(dot)klaver(at)gmail(dot)com>
To: pgsql-sql(at)postgresql(dot)org
Cc: Thomas Kellerer <spam_eater(at)gmx(dot)net>
Subject: Re: UPDATE COMPATIBILITY
Date: 2012-01-17 15:19:47
Message-ID: 201201170719.47830.adrian.klaver@gmail.com (view raw or flat)
Thread:
Lists: pgsql-sql
On Tuesday, January 17, 2012 12:49:44 am Thomas Kellerer wrote:
> Gera Mel Handumon, 17.01.2012 07:31:

> 
> None as far as I know.
> 
> 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

Gets you a little closer to what you want:)

-- 
Adrian Klaver
adrian(dot)klaver(at)gmail(dot)com

In response to

Responses

pgsql-sql by date

Next:From: Thomas KellererDate: 2012-01-17 16:28:40
Subject: Re: UPDATE COMPATIBILITY
Previous:From: David JohnstonDate: 2012-01-17 14:05:44
Subject: Re: sql query problem

Privacy Policy | About PostgreSQL
Copyright © 1996-2014 The PostgreSQL Global Development Group