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

Re: question re incrementing an integer field in a table.

From: Thomas Kellerer <spam_eater(at)gmx(dot)net>
To: pgsql-novice(at)postgresql(dot)org
Subject: Re: question re incrementing an integer field in a table.
Date: 2011-12-16 11:24:56
Message-ID: jcf9oc$sph$1@dough.gmane.org (view raw or flat)
Thread:
Lists: pgsql-novice
richard terry, 16.12.2011 11:57:
> Is there a simple way to increment the value of an integer field in a table in
> sql  without reading the fields value  adding 1 and re-saving? (the field is not
> a primary key or any other sort of foreign key)
>

Not sure I understand you question, but are you maybe looking for:

update the_table
   set the_column = the_column + 1;


Thomas


In response to

pgsql-novice by date

Next:From: Aleksej TrofimovDate: 2011-12-16 11:26:26
Subject: Re: question re incrementing an integer field in a table.
Previous:From: Thom BrownDate: 2011-12-16 11:09:05
Subject: Re: question re incrementing an integer field in a table.

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