I have three tables Professor
, Course
, Comment
I'm trying to get the comments and course names for a given professor.
I have the following SQL:
SELECT prefix, code, info, date
FROM Course C, Comment Co, Professor P
WHERE P.pID = 273
AND C.cID = Co.cID AND P.pID = Co.pID;
Tables:
This returns an empty set开发者_Python百科, when it should return 2 or 3 results. I doubled check the records in Comment..
Even if I try running:
SELECT *
FROM Course C, Comment Co, Professor P
WHERE P.pID = Co.pID AND P.pID = 273;
It gives me ALL the courses??
It's possible that you are not joining on the wrong types/values. If you could provide some of your test data, I am happy to take a further look.
精彩评论