Updating entry WITHOUT updating timestamp

前端 未结 5 462
旧时难觅i
旧时难觅i 2020-12-02 16:38

I have a timestamp in a mysql table with attribute \"ON UPDATE CURRENT_TIMESTAMP\". Is there a way to manually disable updating the timestamp on a special occasion? (eg: upd

5条回答
  •  借酒劲吻你
    2020-12-02 16:50

    If you do change timestemp on update then you have to take into your consideration that if the value was updated but not changed (updated the save value) then it will not update the "on update Current_timestemp" and on this situation you should set the timestemp manually

    SET LastUpdatedDate=NOW() WHERE
    

    The idea came from here: Touch MYSQL record to update TIMESTAMP field

提交回复
热议问题