At 18:33 +0200 4/5/02, Hihn Jason wrote:
>I have a table whose schema contains:
>id INTEGER AUTO_INCREMENT,
>gen_time TIMESTAMP,
>rec_time TIMESTAMP,
>repeats INTEGER DEFAULT 0,
>PRIMARY KEY (id),
>INDEX (rec_time))
>
>When I do an:
>UPDATE table SET repeats=repeats+1
>
>gen_time gets updated as well:

Of course.  That's how TIMESTAMP works.

The manual is your friend:

http://www.mysql.com/doc/D/A/DATETIME.html

>mysql> select id, gen_time, rec_time, repeats from table;
>+----+----------------+----------------+---------+
>| id | gen_time       | rec_time       | repeats |
>+----+----------------+----------------+---------+
>|  1 | 20020404164500 | 20020405111308 |       0 |
>+----+----------------+----------------+---------+
>1 row in set (0.01 sec)
>
>mysql> update table set repeats=repeats+1 where id='1';
>Query OK, 1 row affected (0.01 sec)
>Rows matched: 1  Changed: 1  Warnings: 0
>
>mysql> update table set repeats=repeats+1 where id='1';
>Query OK, 1 row affected (0.02 sec)
>Rows matched: 1  Changed: 1  Warnings: 0
>
>mysql> update table set repeats=repeats+1 where id='1';
>Query OK, 1 row affected (0.02 sec)
>Rows matched: 1  Changed: 1  Warnings: 0
>
>mysql> select id, gen_time, rec_time, repeats from table;
>+----+----------------+----------------+---------+
>| id | gen_time       | rec_time       | repeats |
>+----+----------------+----------------+---------+
>|  1 | 20020405112158 | 20020405111308 |       3 |
>+----+----------------+----------------+---------+
>1 row in set (0.02 sec)
>
>Is this a bug or am I forgetting something?


---------------------------------------------------------------------
Before posting, please check:
   http://www.mysql.com/manual.php   (the manual)
   http://lists.mysql.com/           (the list archive)

To request this thread, e-mail <[EMAIL PROTECTED]>
To unsubscribe, e-mail <[EMAIL PROTECTED]>
Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php

Reply via email to