我不知道为什么我在测试这个函数时会出现这个错误。有人能帮我修一下吗?你知道吗
cur.execute(q, args)
sqlite3.OperationalError: near "FROM": syntax error
这是我想要的输出:
print(get_course_time(db, "MGEB02H3F"))
# [('MGEB02H3F', '214', '17-12-14', '14:00'), ('MGEB02H3F', '215', '17-12-14', '14:00'),
# ('MGEB02H3F', '216', '17-12-14', '14:00'), ('MGEB02H3F', '217', '17-12-14', '14:00'),
# ('MGEB02H3F', '218', '17-12-14', '14:00')]
当前代码:
def get_course_time(db, course):
"""Return the course number, ID, the date and start time of the given
course's exam for all sections. Note there are only multiple sections
if the course IDs are different."""
return run_query(db, '''SELECT Courses.Course FROM Courses
JOIN Time on Time.Course, ID, Date, Start
FROM Time WHERE course = ?''', (course,))
我就是这么做的,而且很管用。。。你知道吗
[('ACTB40H3F','1','17-12-12','14:00')]
您必须记住,在python中,您需要执行某些方法,以便为代码添加额外的参数。好好享受!你知道吗
在
JOIN
子句的末尾有第二个FROM
。而且,JOIN
子句似乎是错误的,但是您看到的错误是因为第二个FROM
。你知道吗相关问题 更多 >
编程相关推荐