2 messages in com.mysql.lists.mysqlRe: SQL update statement updates mult...
FromSent OnAttachments
step...@xenon.newace.ca02 Apr 2000 15:53 
Benjamin Pflugmann02 Apr 2000 17:05 
Subject:Re: SQL update statement updates multiple fields when only one field specified.
From:Benjamin Pflugmann (phil@spin.de)
Date:04/02/2000 05:05:19 PM
List:com.mysql.lists.mysql

Hi.

What you describe is the documented and expected behaviour of the TIMESTAMP column type, so I assume that creationdate is of this type (i.e. you should have quoted your table structure, too ;-).

TIMESTAMP has a magic behaviour. Read the according manual section for more info about this. If you don't want the magic behaviour, use DATETIME instead.

Bye,

Benjamin.

On Sun, Apr 02, 2000 at 06:53:22PM -0400, you wrote

Description:

I am attempting to update a field with the current date and time. After the update has taken place, another field is also updated with the exact same information. This is totally unexpected. [...] * Both fields above indicate different dates and times. Now, I'm
attempting to set just the lastlogindate to the current time.

mysql> update user set lastlogindate=now() where keyno='00000000710902292449'
\g Query OK, 1 row affected (0.00 sec) Rows matched: 1 Changed: 1 Warnings: 0

* After the update, I check the value of both fields.

mysql> select creationdate,lastlogindate from user where
keyno='00000000710902292449' \g +----------------+----------------+ | creationdate | lastlogindate | +----------------+----------------+ | 20000402183157 | 20000402183157 | +----------------+----------------+ 1 row in set (0.00 sec)

* Why did the field creationdate also get update eventhough it wasn't explicity
told to do so?

[...]