处理'同时更新内容SQL查询

时间:2017-08-19 11:05:10

标签: mysql

我有一个SQL查询: -

"""UPDATE table SET column1 = '%s' WHERE columnId = '%s' """ %(columnContent,columnId)

当我更新某些内容时:

It caters to customers in more than 100 international destinations through its online portals at Macys.com. A major attraction is its events such as Macy's 4th of July Fireworks, Macy's Thanksgiving Day Parade, fashion shows, culinary events, flower shows, celebrity appearances and more.

然后它出错:

_mysql_exceptions.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 's 4th of July Fireworks' at line 1")

请帮帮我。

1 个答案:

答案 0 :(得分:1)

应该是:

"""
   UPDATE table
   SET column1=%s
   WHERE columnId=%s
""", (columnContent, columnId)