开发者

MySQL: Ignore the timestamp attribute

开发者 https://www.devze.com 2022-12-30 14:52 出处:网络
I have a timestamp column in my database, and i use it for almost every field, but now, i just want to update the hit counter.. and i do not want to update the timestamp column with it. I use the time

I have a timestamp column in my database, and i use it for almost every field, but now, i just want to update the hit counter.. and i do not want to update the timestamp column with it. I use the timestamp field to see the last 'content' update. Not for every hit.

Is it possible to let mysql stop updating the timest开发者_开发技巧amp column for just one query?


UPDATE mytable SET counter_field = counter_field + 1,
timestamp_field = timestamp_field


That's why I never use timestamp in my web projects. As I have full control on my queries, I can always set update time manually, without relying on the unpredictable timestamp mechanism.

0

精彩评论

暂无评论...
验证码 换一张
取 消