在另外两张表上,我已经将 foreign 设置为 d_desavanja->id 字段,但在这张表上,我不能。
我怎样才能让它工作?
SQL query:
ALTER TABLE `d_des_kat` ADD FOREIGN KEY ( `desavanje_id` ) REFERENCES `desavanja`.`d_desavanja` (
`id`
) ON DELETE CASCADE ON UPDATE CASCADE ;
MySQL said:
#1452 - Cannot add or update a child row: a foreign key constraint fails (`desavanja/#sql-12f3_5af2e`, CONSTRAINT `#sql-12f3_5af2e_ibfk_1` FOREIGN KEY (`desavanje_id`) REFERENCES `d_desavanja` (`id`) ON DELETE CASCADE ON UPDATE CASCADE)