Re: update syntax - Mailing list pgsql-sql

From Bruno Wolff III
Subject Re: update syntax
Date
Msg-id 20050615143416.GD7595@wolff.to
Whole thread Raw
In response to Re: update syntax  ("Praveen Raja" <praveen.raja@netlight.se>)
List pgsql-sql
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’


pgsql-sql by date:

Previous
From: Bruno Wolff III
Date:
Subject: Re: Converting varchar to bool
Next
From: Thomas Kellerer
Date:
Subject: Re: SELECT very slow