I am using mysql through a socket, and I am updating 4000 records therefore I need to mass INSERT / UPDATE them to reduce network lag. The problem is that I have a column datetime_inserted that I want to set as NOW() when a record is first inserted, but never be replaced when it already exists, therefore REPLACE is not an option and I want to update the record, so IGNORE won’t work.
I don’t really understand the whole ON DUPLICATE KEY UPDATE but I want every column (40 or so) to update EXCEPT for datetime_inserted
How can I do this?
1 Answer