我收到错误
字段列表中的列expeertID不明确
我不确定如何解决此问题
INSERT INTO cv(expertID)
SELECT expertID
FROM experts
INNER JOIN cv ON experts.expertID = cv.expertID;
答案 0 :(得分:4)
尝试以下操作-由于两个表中都存在tablename
,因此您需要添加expertID column
INSERT INTO cv(expertID)
SELECT experts.expertID
FROM experts
INNER JOIN cv ON experts.expertID = cv.expertID;
答案 1 :(得分:3)
您需要将column name
与tablename
指定要从哪个表中显示,或者指定insert
所需的数据:
INSERT INTO cv(expertID)
SELECT e.expertID
FROM experts e INNER JOIN
cv
ON e.expertID = cv.expertID;
答案 2 :(得分:0)
尝试一下!
我使用了表别名,然后在选择列表中用列明确提到了别名。现在,select中的expertID来自experts表,而不是模棱两可的。
INSERT INTO cv(expertID)
SELECT e.expertID
FROM experts e
INNER JOIN cv c ON e .expertID = c.expertID;