即使所有其他行数据保持相同,MySQL UPDATE TIMESTAMP仍在行UPDATE上? [英] MySQL UPDATE TIMESTAMP on row UPDATE, even when all other row data remains the same?

查看:153
本文介绍了即使所有其他行数据保持相同,MySQL UPDATE TIMESTAMP仍在行UPDATE上?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个带有时间戳的表.

I have a table with a timestamp.

时间戳记设置为"ON UPDATE CURRENT_TIMESTAMP".

当我用与该行中已有数据相同的数据对行进行更新时,我仍然希望更新TIMESTAMP.它不是.为什么不呢?如果数据不同,则更新就可以了.

When I run an update on a row with data that is the same as the data already in that row, I still want the TIMESTAMP to update. It does not. Why does it not? If the data is different it updates just fine.

我意识到我可以强制使用TIMESTAMP = now()进行更新,但是我试图了解MySQL在做什么.

I realize I can force an update with TIMESTAMP = now(), but I am trying to understand what MySQL is doing.

推荐答案

您已经说过ON UPDATE.

如果所有行的值都相同,则不会发生更新.

There is no update happening if all the row's values are the same.

这篇关于即使所有其他行数据保持相同,MySQL UPDATE TIMESTAMP仍在行UPDATE上?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆