pg.ddx.io  pgsql-sql@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Bruno Wolff III <bruno@wolff.to>
To: Praveen Raja <praveen.raja@netlight.se>
Cc: 'Bruno Prévost' <bp@interaction.ws>
Cc: pgsql-sql@postgresql.org
Subject: Re: update syntax
Date: Wed, 15 Jun 2005 09:34:16 -0500
Message-ID: <20050615143416.GD7595@wolff.to> (raw)
In-Reply-To: <003001c571a6$c337a1c0$4c0ca8c0@sek.se>
References: <006b01c571a4$dbbb7d40$5d00a8c0@BRUNO2500>
	<003001c571a6$c337a1c0$4c0ca8c0@sek.se>

On Wed, Jun 15, 2005 at 14:35:42 +0200,
  Praveen Raja <praveen.raja@netlight.se> wrote:
> Thanks. The UPDATE works ok now. But using the same logic it doesn’t
> seem possible to delete rows. Is this also possible?

Yes. When you use table names in the where clause they are automatically
added to the join list if they aren't list in the from item list.

For 8.1 this will be changing. There will be a USING clause on DELETE
statements that can be used to list extra tables and the implied
from feature will be disabled by default.

> 
> Try something like this
> 
>  
> 
> UPDATE table1
> SET col1 = b.col1
> FROM table1 b
> WHERE table1.col2 = b.col2 and
> table1.col3 = ‘something’ and
> b.col3 = ‘somethingelse’



view thread (5+ messages)

Message-ID: <20050615143416.GD7595@wolff.to>
Permalink:  ../20050615143416.GD7595@wolff.to/
Also on:    postgresql.org/message-id/20050615143416.GD7595@wolff.to

 · 

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: bruno@wolff.to, praveen.raja@netlight.se, bp@interaction.ws
  Subject: Re: update syntax
  In-Reply-To: <20050615143416.GD7595@wolff.to>

* 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