Try:

   UPDATE table SET aColumn = someNewValue, numTouched = numTouched + 1
   WHERE <predicates>;

Regards.

rayB



|---------+---------------------------->
|         |           Tito Ciuro       |
|         |           <[EMAIL PROTECTED]> |
|         |                            |
|         |           22/03/2006 11:54 |
|         |           Please respond to|
|         |           sqlite-users     |
|         |                            |
|---------+---------------------------->
  
>--------------------------------------------------------------------------------------------------------------|
  |                                                                             
                                 |
  |       To:       Forum SQLite <sqlite-users@sqlite.org>                      
                                 |
  |       cc:                                                                   
                                 |
  |       Subject:  - [sqlite] Incrementing the value of a column               
                                 |
  
>--------------------------------------------------------------------------------------------------------------|




Hello,

This is the schema: ROWID INTEGER, myText TEXT, numTouched INTEGER

Each time I update a record I'd like to increment its 'numTouched'
column. I could read the record, retrieve the numTouched value,
increment it by 1, then update the record with the new text and
touched values.

Is there a way to do that without SELECT(ing) first the record?

Thanks,

-- Tito




************** PLEASE CONSIDER OUR ENVIRONMENT BEFORE PRINTING
*************
******************* Confidentiality and Privilege Notice
*******************

This e-mail is intended only to be read or used by the addressee. It is 
confidential and may contain legally privileged information. If you are not the 
addressee indicated in this message (or responsible for delivery of the message 
to such person), you may not copy or deliver this message to anyone, and you 
should destroy this message and kindly notify the sender by reply e-mail. 
Confidentiality and legal privilege are not waived or lost by reason of 
mistaken delivery to you.

Qantas Airways Limited
ABN 16 009 661 901

Visit Qantas online at http://qantas.com

****************************************************************************

Reply via email to