2

行数の多いsqliteでテーブルを更新したい

tablenew  
id  status
a   old
b   ask
c   old
d   old

等...

list = ['a', 'b', 'c']

cur.execute("update tablenew set status =? where id = ?", ('new',list))

Pythonでこれを行う方法は?

4

1 に答える 1

4

IN次の演算子を使用します。

cur.execute("update tablenew set status = ? where id IN ?", ('new', list))
于 2012-05-11T06:14:42.550 に答える