sql语法如下:
SELECT y.NAME, y.EMAIL, k.DATE, k.WORK_NR, k.SCORE, k.FILENAME
FROM bas1.students y, bas1.assignments k, bas1.topics a
WHERE y.ID = k.student_id AND k.topic_id = a.id
WHERE a.NAME = 'History';
但我得到一些错误,任何想法?
答案 0 :(得分:8)
你正在使用WHERE两次
SELECT y.NAME, y.EMAIL, k.DATE, k.WORK_NR, k.SCORE, k.FILENAME
FROM bas1.students y, bas1.assignments k, bas1.topics a
WHERE y.ID = k.student_id AND k.topic_id = a.id
AND a.NAME = 'History';
更改为
答案 1 :(得分:0)
你不需要加入声明吗?如,
SELECT y.NAME, y.EMAIL, k.DATE, k.WORK_NR, k.SCORE, k.FILENAME
FROM bas1.students y JOIN bas1.assignments k ON y.ID = k.student_id
JOIN bas1.topics a ON k.topic_id = a.id
WHERE a.NAME = 'History';