SELECT info, date
FROM Professor, Professor_Comment, Comment
WHERE pID = ?
AND Professor_Comment.pcID = Professor.pcID
AND Comment.commID = Professor_Comment.commID;
;
答案 0 :(得分:5)
这可能是因为pID
含糊不清而Professor
没有pcID
。
试试这个:
SELECT info, date
FROM Professor_Comment, Comment
WHERE pID = ?
AND Comment.commID = Professor_Comment.commID;
但是,我更喜欢显式的JOIN语法:
SELECT info, date
FROM Professor_Comment
JOIN Comment ON Comment.commID = Professor_Comment.commID
WHERE pID = ?;
答案 1 :(得分:0)
您有pID = ?
,但pID不明确,因为它显示在Professor
和Professor_Comment
将唯一的pID更改为Professor.pID
或Professor_Comment.pID
您有Professor_Comment.pcID = Professor.pcID
,教授表将其列为dID
,而不是pcID