Refresh mysql table with same values ​​and still get timestamp update

So, I have this row stamp timestamp DEFAULT NOW() ON UPDATE NOW()in my table, and I need it to be updated, even when the update I am doing is basically the same data in all fields.

Is there a way to do this in the table declaration, as well as in another option other than on update, or do I need to force click stamp = now()every time I update (and delete on update, of course, since it will be useless).

I saw this stream , but it only answers what is happening and why, and not how to get around it, except that it is indirectly indirect

+5
source share
3 answers

.

DELIMITER GO

CREATE TRIGGER `mydb`.`mytable_U` BEFORE UPDATE ON `mydb`.`mytable`  
FOR EACH ROW 
BEGIN  
    SET NEW.stamp = CURRENT_TIMESTAMP;   
END
GO

DELIMITER ;
+2

@veeTrain, . , unix_timestamp().

UPDATE _ SET last_logged_in = unix_timestamp() WHERE = '$user_id'

, , , , .

+3

:

UPDATE table_name SET last_logged_in = NOW() WHERE `user_id`...

, , , . ; , .

+1

All Articles