cur = mysql.connection.cursor()
cur.execute("""Select Qid, Username, Question, StdName, SubName, PostDate, AnsCount from user
inner join Textual_Question, subjects, standard where
Textual_Question.Qid = {} and
user.Uid = Textual_Question.Uid and
Textual_Question.Subject = subjects.Subkey and
Textual_Question.standard =standard.StdKey""".format(Qid))
(1064,“您的SQL语法有误;请查看与您的MySQL服务器版本相对应的手册,以获取在'}和\ n用户附近使用的正确语法。Uid= Textual_Question.Uid和\ n Textual_Question。 Subje'在第3行“)
答案 0 :(得分:0)
我想你错过了右括号。
cur.execute("""Select Qid, Username, Question, StdName, SubName, PostDate, AnsCount from user
inner join Textual_Question, subjects, standard where
Textual_Question.Qid = '{0}' and
user.Uid = Textual_Question.Uid and
Textual_Question.Subject = subjects.Subkey and
Textual_Question.standard = standard.StdKey""".format(Qid))