MySQL – Update Column Without Auto Timestamp Update

innodbMySQL

Hello everyone I have got a product stock table with a time-stamp column so the so any updated to that row will update the time stamp ,I'm happy with this setting but sometimes I want to update the row without updating the time stamp,so how to write mysql statement that update a specific column without updating the lastUpdate column ?

this my statement:
update productsStock set productName="HP PRINTER 20000" where product_reference="001";

productsStock table description

describe productsStock;

+--------------------+-----------------------+------+-----+-------------------+-----------------------------+
| Field | Type | Null | Key | Default | Extra |
+--------------------+-----------------------+------+-----+-------------------+-----------------------------+
| productID | int(10) | NO | PRI | NULL | auto_increment |
| product_reference | varchar(255) | NO | PRI | NULL | |
| productName | varchar(255) | NO | UNI | NULL | |
| brand | varchar(45) | NO | | NULL | |
| model | varchar(100) | NO | PRI | NULL | |
| productDescription | varchar(255) | YES | | NULL | |
| physicalStock | int(10) unsigned | YES | | 0 | |
| price | decimal(7,2) unsigned | YES | | 0.00 | |
| location | varchar(45) | NO | | NULL | |
| lowStockAlert | int(10) unsigned | YES | | 0 | |
| lastUpdateBy | varchar(45) | NO | | NULL | |
| lastUpdate | timestamp | NO | | CURRENT_TIMESTAMP | on update CURRENT_TIMESTAMP |
+--------------------+-----------------------+------+-----+-------------------+-----------------------------+

Best Answer

When you do your update, set the lastUpdate column equal to itself, that way it won't default in the current timestamp:

 update productsStock set productName="HP PRINTER 20000", lastUpdate = lastUpdate where product_reference="001";