【发布时间】:2016-07-09 10:46:13
【问题描述】:
我无法弄清楚为什么我会收到此错误消息....
SELECT student.student, course.coursename, course.coursehours, section.day, section.starttime, course.building, location.room
FROM student, course, section, location, registration
WHERE course.courseid = section.courseid, location.locationid =
section.locationid, student.studentid = registration.sectionid,
section.sectionid = registration.sectionid;
Error at line 3:
ORA-00933: SQL command not properly ended
我将数据更新为如下所示:
SELECT student.studentid,
course.coursename,
course.credithours,
section.days,
section.starttime,
location.building,
location.room
FROM student
INNER JOIN registration
ON student.studentid = registration.sectionid
INNER JOIN section
ON section.sectionid = registration.sectionid
INNER JOIN location
ON location.locationid = section.locationid
INNER JOIN course
ON course.courseid = section.courseid;
但现在它说“没有选择行”?
【问题讨论】:
-
错误信息是什么?这是 MySQL、SQLite、PostgreSQL 吗?
-
@Prdp 当我发表评论时它没有被标记为 Oracle。
-
你尝试调试什么?您现在要加入 5 张桌子。加入 2 个表。如果你得到你期望的数据,添加另一个。在每一步建立它的测试。不要编写整个查询然后对其进行测试。如果你这样做,我怀疑你会发现从
student到registration的连接是错误的。我怀疑studentid匹配sectionid。我猜你打算加入的registration中有一个studentid。