How to Force UPDATE of MySQL Record When Nothing Is Changing

别等时光非礼了梦想. 提交于 2019-12-02 00:35:55

问题


My database table has a column defined to use ON UPDATE CURRENT_TIMESTAMP:

  • Field: last_access
  • Type: timestamp
  • Collation:
  • Attributes: on update CURRENT_TIMESTAMP
  • Null: No
  • Default: CURRENT_TIMESTAMP
  • Extra: ON UPDATE CURRENT_TIMESTAMP

How can I force this last_access field to update for a given record when no other data in the record is changing?


回答1:


UPDATE your_table SET last_access = CURRENT_TIMESTAMP(); ?



来源:https://stackoverflow.com/questions/9218705/how-to-force-update-of-mysql-record-when-nothing-is-changing

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!