Calculation in update query

From: "Christopher A(dot) Goodfellow" <cgoodfellow(at)tealuxe(dot)com>
To: <pgsql-novice(at)postgresql(dot)org>
Subject: Calculation in update query
Date: 2004-09-30 15:39:09
Message-ID: 001501c4a703$a164e120$070a640a@tealuxe.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-novice

I want to be able to update a value in a table to the existing value plus
or minus a value set in a variable without having to read in the current
value first. Any help would be appreciated.

The desired action could be described like the following query:

UPDATE tablename SET columnname='currentvalue_in_column +-
value_in_variable' WHERE key='key_variable';

Thank You,
Christopher A. Goodfellow
Director of Information Technology
Tealuxe, Inc.
Phone: 508 520 7887 ex:22
Fax: 508 528 8999
www.tealuxe.com
tea for all

Responses

Browse pgsql-novice by date

  From Date Subject
Next Message Oliver Fromme 2004-09-30 16:03:06 Re: Calculation in update query
Previous Message Ramon Orticio 2004-09-30 01:56:03 can't connect to postmaster or postgresql server