Re: update syntax

From: Bruno Wolff III <bruno(at)wolff(dot)to>
To: Praveen Raja <praveen(dot)raja(at)netlight(dot)se>
Cc: 'Bruno Prévost' <bp(at)interaction(dot)ws>, pgsql-sql(at)postgresql(dot)org
Subject: Re: update syntax
Date: 2005-06-15 14:34:16
Message-ID: 20050615143416.GD7595@wolff.to
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-sql

On Wed, Jun 15, 2005 at 14:35:42 +0200,
Praveen Raja <praveen(dot)raja(at)netlight(dot)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’

In response to

Browse pgsql-sql by date

  From Date Subject
Next Message Thomas Kellerer 2005-06-15 18:05:28 Re: SELECT very slow
Previous Message Bruno Wolff III 2005-06-15 14:31:24 Re: Converting varchar to bool