MySql UPDATE相当于什么?
INSERT INTO items (title, url) VALUES (%s, %s)", (listtitle[0], listlink[0]))
答案 0 :(得分:1)
"update items
set title = '{0}',
url = '{1}'
where COLUMN = VALUE
and COLUMN2 = VALUE2".format(listtitle[0], listlink[0])
将大写字母替换为特定值,否则您将更新整个表格。
Unknown column in 'field list' error on MySQL Update query
试试这个
self.cursor.execute("UPDATE items SET descs ='{0}'".format(item['title'][0]))
而不是
self.cursor.execute('UPDATE items SET descs =%s' % item['title'][0])
答案 1 :(得分:0)
试试这个:
"UPDATE items SET title = %s, url= %s" % listtitle[0], listlink[0]