親愛的所有人,我在MySQL中遇到問題: 我在MySQL CLI中未能執行DELETE FROM users where user_id ='1';
。 於是,我就在phpMyAdmin的: 使用GUI刪除行,我得到這個:無法刪除表中的一行(MySQL)
SQL查詢:
DELETE FROM `health_portal`.`users` WHERE `users`.`user_id` =1
MySQL表示:文件
Cannot delete or update a parent row: a foreign key constraint fails (`health_portal`.`users`, CONSTRAINT `users_ibfk_2` FOREIGN KEY (`doctor_id`) REFERENCES `users` (`user_id`))
我擡頭一看這個錯誤在Mysql網站並得到: 錯誤:1451 SQLSTATE:23000(ER_ROW_IS_REFERENCED_2)
消息:不能de lete或更新父行:外鍵約束失敗(%s)
我不知道這裏出了什麼問題,希望任何人都可以給我一個提醒。
很多thx!
非常感謝。現在我的問題解決了!謝謝!!! – manxing 2010-12-17 18:11:34