我在使用以下插入查询时遇到问题。
INSERT INTO CM_LABEL_CALENDAR (
label_id,
label_name,
order_seq,
meal_id,
hyperlink
)
SELECT
label_id,
label_name,
order_seq,
(meal_id + 315),
hyperlink
FROM
CM_LABEL_CALENDAR
WHERE
(meal_id BETWEEN '1466' AND '1521');
当我尝试执行它时,我收到以下错误:
查找错误 - MySQL数据库错误:无法添加或更新子行:外键约束失败(
TEST_PBMS
。CM_LABEL_CALENDAR
,CONSTRAINTCM_LABEL_CALENDAR_ibfk_1
FOREIGN KEY(meal_id
)参考CM_MEAL_CALENDAR
(meal_id
))
我试过寻找答案但找不到答案。
答案 0 :(得分:0)
CM_LABEL_CALENDAR(meal_id)
和CM_MEAL_CALENDAR(meal_id)
您收到此错误是因为您尝试在meal_id
列中插入CM_MEAL_CALENDAR
表中不存在的值。