开发者

mySQL Query Not Returning properly?

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:

mySQL Query Not Returning properly?

mySQL Query Not Returning properly?

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.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜