Make a quick vote 🗳 ️How do you refer to SuiteCRM extensions: add-ons or plug-ins? Click here to have your say 👈

How to fix this problem? Error Code: 1451. Cannot delete or update a parent row: a foreign key constraint fails (`northwind`.`employees`, CONSTRAINT `FK_Employees_Employees` FOREIGN KEY (`ReportsTo`) REFERENCES `employees` (`EmployeeID`))

DELIMITER // 
create trigger removeEmployee before delete on employees for each row begin
delete FROM employeeterritories  where employeeId = OLD.EmployeeID; 
end //
DELIMITER ;