Re: select & insert

From: Arcady Genkin <a(dot)genkin(at)utoronto(dot)ca>
To: pgsql-novice(at)postgreSQL(dot)org, Mauricio Alarcon <malarcon(at)webdepot(dot)com(dot)co>
Subject: Re: select & insert
Date: 2000-12-20 18:33:28
Message-ID: 8766kfkknb.fsf@tea.thpoon.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-novice

Mauricio Alarcon <malarcon(at)webdepot(dot)com(dot)co> writes:

> How I can make an update to a register from a select query?
> I have this
>
> update table1 set r1=(select r1+1 from table1);

Try this:

update table1 set r1=(select T1.r1+1 from table1 T1);

Note that if there is more than one row in the table1, then you might
want to limit the select clause by some condition.
--
Arcady Genkin
Don't read everything you believe.

In response to

Browse pgsql-novice by date

  From Date Subject
Next Message Wayne Johnson 2000-12-20 18:36:31 Java vs. PHP (was web interface for postgreSQL-P.S.)
Previous Message Karla Peralta 2000-12-20 16:48:59 Speed