SELECT info, date
FROM Professor, Professor_Comment,开发者_运维知识库 Comment
WHERE pID = ?
AND Professor_Comment.pcID = Professor.pcID
AND Comment.commID = Professor_Comment.commID;
;
That's likely to be because the pID
is ambigious and the Professor
doesn't have a pcID
.
Try this:
SELECT info, date
FROM Professor_Comment, Comment
WHERE pID = ?
AND Comment.commID = Professor_Comment.commID;
However, I prefer the explicit JOIN syntax:
SELECT info, date
FROM Professor_Comment
JOIN Comment ON Comment.commID = Professor_Comment.commID
WHERE pID = ?;
You have
pID = ?
, but pID is ambiguous because it appears inProfessor
andProfessor_Comment
Change that sole pID to either
Professor.pID
orProfessor_Comment.pID
You have
Professor_Comment.pcID = Professor.pcID
, the Professor table has it listed asdID
, not pcID
精彩评论