Re: Update from select??

From: Bruno Wolff III <bruno(at)wolff(dot)to>
To: jose antonio leo <jaleo8(at)storelandia(dot)com>
Cc: pgsql-general(at)postgresql(dot)org
Subject: Re: Update from select??
Date: 2003-07-03 19:16:45
Message-ID: 20030703191645.GA24120@wolff.to
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

On Thu, Jul 03, 2003 at 20:37:27 +0200,
jose antonio leo <jaleo8(at)storelandia(dot)com> wrote:
> Hi all,
>
> I need do a update from t1 set col='P' where int_art = (SELECT int_art from
> t2 ....).
> I know that thios sentence is not correct but I'd like do the update for
> everethigs rows that return the select.

You want something like:
update t1 set col = 'P' from t2 where t1.int_art = t2.int_art;

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Mark 2003-07-03 19:42:22 float formating with xx.00
Previous Message Dan Langille 2003-07-03 18:48:50 PGVote : a simple polling/voting PostgreSQL-based system