Answers for "(1452, 'Cannot add or update a child row: a foreign key constraint fails (`krishi_mandi`.`myapp_profile`, CONSTRAINT `myapp_profile_state_id_c8f4da94_fk_state_info_id` FOREIGN KEY (`state_id`) REFERENCES `state_info` (`id`))')"

0

mysql error 1452

SELECT child_table.* 
FROM child_table 
LEFT JOIN parent_table 
  ON parent_table.referenced_column = child_table.referencing_column 
WHERE parent_table.referenced_column IS NULL


-- Delete all data from output of that query
Posted by: Guest on August-28-2020

Code answers related to "(1452, 'Cannot add or update a child row: a foreign key constraint fails (`krishi_mandi`.`myapp_profile`, CONSTRAINT `myapp_profile_state_id_c8f4da94_fk_state_info_id` FOREIGN KEY (`state_id`) REFERENCES `state_info` (`id`))')"

Browse Popular Code Answers by Language