I insert my data using INSERT INTO SELECT
then I have ON DUPLICATE KEY UPDATE
like this:
ON DUPLICATE KEY UPDATE
first_name = COALESCE(eb.first_name, employee.first_name),
middle_name = COALESCE(eb.middle_name, employee.middle_name),
last_name=COALESCE(eb.last_name, employee.last_name),
nickname=COALESCE(eb.nickname, employee.nickname),
gender=COALESCE(eb.gender, employee.gender),
address=COALESCE(eb.address, employee.address),
mobile=COALESCE(eb.mobile, employee.mobile),
birthdate=COALESCE(eb.birthdate, employee.birthdate),
status=COALESCE(eb.status, employee.status),
tr_email=COALESCE(eb.tr_email, employee.tr_email),
position_id = COALESCE(position.id, employee.tr_email);
Now on the same table, there's a column modified_date
, that I need to also update the value(insert the current date) when any column above gets updated. Is there a solution without creating a new table or some sort to compare the old values to the new one? Many thanks in advance.