I would like to create a trigger that will delete all database records from the survey_responses for a given survey_responder when delete a record from survey_responder. In other words, when I delete a survey_responder I want to delete their responses from the database so that there are no orphan records. The thing is I keep getting an error. Any help?
DELIMITER $$
CREATE TRIGGER delete_log AFTER DELETE on survey_responders
FOR EACH ROW
BEGIN
delete * from survey_responses
where survey_responders.id = survey_responses.survey_responder_id;
END$$
DELIMITER ;