python 您所在的位置:网站首页 pymysqlerrprogrammingerror python

python

#python| 来源: 网络整理| 查看: 265

これはUNION QUERYに関するコードです:

smith ='Smith' smithb='Smith' sql="""SELECT Distinct Pnumber FROM PROJECT, DEPARTMENT, EMPLOYEE WHERE Dnum = Dnumber AND Mgr_ssn=Ssn AND Lname= %s UNION SELECT Distinct Pnumber PROJECT, WORKS_ON, EMPLOYERE WHERE Pnumber =Pno AND Essn=Ssn AND Lname=%s""" curs.execute(sql,(smith,smithb)) #curs.execute(sql2,('Smith')) conn.commit() rows = curs.fetchall() print(rows)

これはエラーメッセージです!!:

pymysql.err.ProgrammingError: (1064, "You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'WHERE Pnumber =Pno AND Essn=Ssn AND Lname='Smith'' at line 1")

pymysqlユニオンクエリの構文を知る必要があります。ありがとうございます。



【本文地址】

公司简介

联系我们

今日新闻

    推荐新闻

    专题文章
      CopyRight 2018-2019 实验室设备网 版权所有