每当我设置外键时,我都会收到以下错误,我不知道为什么。有人可以帮我搞清楚吗?
Error
SQL query: ALTER TABLE `vl_discount` ADD CONSTRAINT `vl_product_ibfk1` FOREIGN KEY ( `discountedProduct` )
REFERENCES `base`.`vl_product` (`autokey`) ON DELETE CASCADE ON UPDATE CASCADE ;
MySQL said: Documentation
#1452 - Cannot add or update a child row: a foreign key constraint fails
(`base`.`#sql41d_172`, CONSTRAINT `vl_product_ibfk1` FOREIGN KEY (`discountedProduct`)
REFERENCES `vl_product` (`autokey`) ON DELETE CASCADE ON UPDATE CASCADE)