触摸MYSQL记录以更新TIMESTAMP字段 [英] Touch MYSQL record to update TIMESTAMP field

查看:111
本文介绍了触摸MYSQL记录以更新TIMESTAMP字段的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在我的数据库中,我有一个带有列的表

In my Database i have a table with column

`LastUpdated` TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,

我想触摸该表中的一条记录,以便自动更新LastUpdated列,但我不想更改该行中的任何值.

i would like to Touch a record in that table so that LastUpdated column will be automatically updated but i don't want to change any value in that row.

有可能吗?

谢谢.

推荐答案

AFAIK,您没有使用touch来更新mysql表记录的选项,就像您在unix系统中触摸文件一样.您必须对LastUpdated列中的update timestamp发出更新查询.

AFAIK, You don't have options to use touch to update mysql table records like you touch file in unix systems. You have to issue an update query to update the timestamp in the LastUpdated column .

UPDATE mytable SET LastUpdated=NOW() WHERE ...

这篇关于触摸MYSQL记录以更新TIMESTAMP字段的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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