Skip site navigation (1) Skip section navigation (2)

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$ (view raw, whole thread or download thread mbox)
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
tea for all


pgsql-novice by date

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

Privacy Policy | About PostgreSQL
Copyright © 1996-2017 The PostgreSQL Global Development Group