MySQL的CURRENT_TIMESTAMP函数可以用于在UPDATE语句中更新表中的时间戳字段。以下是使用CURRENT_TIMESTAMP函数进行更新操作的技巧:
UPDATE table_name SET timestamp_field = CURRENT_TIMESTAMP WHERE condition;
UPDATE table_name SET timestamp_field_1 = CURRENT_TIMESTAMP, timestamp_field_2 = CURRENT_TIMESTAMP WHERE condition;
UPDATE table_name SET timestamp_field_1 = CURRENT_TIMESTAMP, timestamp_field_2 = CURRENT_TIMESTAMP, ... WHERE condition;
UPDATE table_name SET timestamp_field = NULL WHERE condition;
UPDATE table_name SET timestamp_field = '2022-01-01 00:00:00' WHERE condition;
请注意,使用CURRENT_TIMESTAMP函数会将当前时间戳更新到字段中,因此可以确保时间戳字段始终包含最新的时间信息。