Timestamp without change on update

后端 未结 4 1807
感情败类
感情败类 2020-12-19 11:50

In mysql I have a timestamp with the field name added_on. I created that for a table of leads for a crm. But it\'s getting updated whenever I updat

4条回答
  •  一生所求
    2020-12-19 12:17

    If you want control over the timestamp, just change it to DATETIME and then update it yourself when you want to with added_on=NOW()

    This is what I do to avoid complications, then you can be sure that you have complete control over it, which is also useful for archiving or moving data between tables, because you would not want the timestamp to update itself in this case.

提交回复
热议问题