pg.ddx.io  pgsql-sql@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Richard Huxton <dev@archonet.com>
To: Venelin Arnaudov <v.arnaudov@prosyst.com>
Cc: pgsql-sql@postgresql.org
Subject: Re: Problems with bulk update
Date: Thu, 27 Sep 2007 10:27:09 +0100
Message-ID: <46FB776D.5080406@archonet.com> (raw)
In-Reply-To: <46FB6822.9060507@prosyst.com>
References: <46FB6822.9060507@prosyst.com>

Venelin Arnaudov wrote:
> Hi
> 
> I want to update the values of one column of a table based on the
> matches in a second table

> something like
> update table1
>  set table1.field2_new=table2.new_id
>  from table2
>  where table1.field2_old=table2.old_id;

Did you try it?

http://www.postgresql.org/docs/8.2/static/sql-update.html

PG has a non-standard "FROM" extension for just this purpose.

-- 
   Richard Huxton
   Archonet Ltd



view thread (3+ messages)  latest in thread

Message-ID: <46FB776D.5080406@archonet.com>
Permalink:  ../46FB776D.5080406@archonet.com/
Also on:    postgresql.org/message-id/46FB776D.5080406@archonet.com

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients using the --to and --cc options:
  reply via email

  To: pgsql-sql@postgresql.org
  Cc: dev@archonet.com, v.arnaudov@prosyst.com
  Subject: Re: Problems with bulk update
  In-Reply-To: <46FB776D.5080406@archonet.com>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox