mysql> create database pmtest; Query OK, 1 row affected (0.09 sec) mysql> use pmtest; Database changed mysql> create table t (id smallint, count smallint, time datetime); + Query OK, 0 rows affected (0.01 sec) mysql> insert into t values (1,1,now()); Query OK, 1 row affected (0.00 sec) mysql> insert into t values (2,1,now()); Query OK, 1 row affected (0.00 sec) mysql> insert into t values (3,1,now()); Query OK, 1 row affected (0.00 sec) mysql> update t set count=count+1, time=now() where id=2; Query OK, 1 row affected (0.02 sec) Rows matched: 1 Changed: 1 Warnings: 0 mysql> update t set count=count+1, time=now() where id=2; Query OK, 1 row affected (0.00 sec) Rows matched: 1 Changed: 1 Warnings: 0 mysql> select * from t; +------+-------+---------------------+ | id | count | time | +------+-------+---------------------+ | 1 | 1 | 2007-02-22 19:26:39 | | 2 | 3 | 2007-02-22 19:27:06 | | 3 | 1 | 2007-02-22 19:26:45 | +------+-------+---------------------+ 3 rows in set (0.01 sec)
In reply to Re^3: Updating a mysql row - testing with a throwaway table
by imp
in thread Updating a mysql row
by Anonymous Monk
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |