The last_dt column is the date when the data was last changed. It is managed differently than inserted dates. Inserted dates are managed by create_dt.
I only want to change the value of the update date when other columns besides the update_dt column change.
So gpt gave me this:
UPDATE your_table SET column1 = %s, column2 = %s, column3 = %s, update_date = IF( column1 <> %s OR column2 <> %s OR column3 <> %s, NOW(), update_date ) WHERE id = %s
But I think this method is a bit strange. I actually tested it and found an error. It's also possible that I wrote the code wrong.
Is there a better way? Is the answer provided by gpt correct? I think many database administrators have solved the same problem. I ask this question because I can't find a suitable answer.
I think I have to use this