当另一列是当前日期时,如何更新日期列?

时间:2014-11-29 22:22:33

标签: mysql

当handtool_next_date_of_maintenance是当前日期时,需要将列handtool_last_date_of_maintenance更新为当前日期。这个的确切语法是什么?谢谢

|| *handtool_id* || *handtool_last_date_of_maintenance* || *handtool_next_date_of_maintenance* ||
|| 1 || 2014-11-07 || 2015-05-08 ||

1 个答案:

答案 0 :(得分:0)

您可以使用now

的简单更新语句
update Table1
set handtool_last_date_of_maintenance = date(now())
where handtool_next_date_of_maintenance = date(now())