我在克服此错误方面遇到了一些麻烦。当我完整地执行SELECT语句时,会显示重复的消息。
代码是:
SELECT students.first_name, last_name ,entries.subject_id, subject_name, level_of_entry
FROM students, subjects , entries
WHERE subjects.subject_id=entries.subject_id
AND students.student_id=entries.student_id
AND exam_board='ocr';
This is what happens after that code is processed
These are the tables which the data is coming from
有没有办法停止复制或删除其中一个重复的行?
重复的行是第6行和第7行;与Zeynnata Rein合作。
提前感谢您的帮助!!!
PS:抱歉物理拼写错误
答案 0 :(得分:0)
你必须在student_id上使用group by
答案 1 :(得分:0)
因为您没有加入表格,所以它会返回所有匹配的组合。尝试显式连接:
SELECT auth.name
FROM Blog blo
LEFT JOIN Auth auth
WHERE blo.authname = "janet"