Sample Header Ad - 728x90

How to virtually update parent table when child table gets updated

0 votes
2 answers
1584 views
I have parent table let say CAR, and its multiple props/records in child table let say CAR_PROPS. Now CAR has modified_date column like modified_date timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, Since CAR along with its all properties are treated as single object, we are expecting any change on its props (CAR_PROPS) alone should also update the parent table (CAR's) modified_date. However this is not real since CAR doest really updated hence modified_date is not changed when any of its child record got updated. To simplify i want sql column modified_date to be updated, though i dont have anything/anyother column to update in the row. How to solve this problem? NOTE: I dont want to pass the modified_date from server, just want go with DB timestamp.
Asked by Kanagavelu Sugumar (87 rep)
Apr 24, 2018, 09:42 AM
Last activity: Jul 5, 2025, 04:09 AM