I have table1
with 3 columns: id varchar(20)
, name
, mother_id varchar(20)
. mother_id
is a foreign key referring to the id
column in the same table.
Here is my table:
|id |name |mother_id|
|dog1 |my_dog | (null)
|dog2 |my_dog2 | dog1
|dog3 |my_dog3 | dog1
If I tried to update dog1
and change dog4
I have this error:
Cannot delete or update a parent row: a foreign key constraint fails (`dogs`.`table1`, CONSTRAINT `FK_dogs1` FOREIGN KEY (`mother_id`) REFERENCES `accounts` (`id`) ON DELETE CASCADE ON UPDATE CASCADE)
How to solve this problem? I'm using wamp 2.0 h
and Sqlyog
enterprise.