We've got about 1,000 records in a table that have timestamps on them.
We've ran into a situation where we need to go back and update one field in
all of those records without altering the timestamp. since the timestamp is
automatically changed when the record is updated we are in a bind.
The
Never mind, I just figured it out:
First, I copied the whole 'hits' table to 'hits_bak', then ran this:
INSERT INTO `csrtech_dirserv`.`hits`
SELECT `SID` , 2 AS `AID` , `Phrase` , `IP` , `Link` , `Time` ,
`Amt` , `F`
FROM `csrtech_dirserv`.`hits_bak`
WHERE `SID` =5
So that coppied
The simple solution is to explicitly set the timestamp column to the value
it already has. Assuming Time is your timestamp column, you need:
UPDATE `table`
SET `AID` = 2, Time = Time
WHERE `SID` = 5;
See the manual for more
http://dev.mysql.com/doc/mysql/en/TIMESTAMP_pre-4.1.html.