Hi,
I’m trying to figure out how to potentially not have my timestamp column not get updated for a special case.
Quick high level of workflow:
- External process updates records in table.
- Internal process queries table for all changes base on the modified date timestamp
- Then process the records, push them back into the db updating some data
Now the issue is in step 2, I would query the timestamp to get the updated records, but in step 3 I’m also updating the records unless the record didn’t change. Step 2 would pick it up again.
How can I still update the record but have the modified date timestamp not get updated?
The doc mention including the modified date timestamp column in the update statement would ignore but I’m struggling on a clean way to put a good value.
I could join to the table itself to extract the current timestamp but that seems slow and hacky. Alternatively I could use the timestamp when I first read the record but then the update would not be atomic.
Ideally I’d want to use the VALUES() function but it seems to only work on ON DUPLICATE KEY
statements.
Any insight here would greatly be appreciated.
Thanks,
Oak