2

I want to update table on sqlite contained with many rows

tablenew  
id  status
a   old
b   ask
c   old
d   old

etc...

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

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

how to do this in python?

1 Answer 1

4

Use the IN operator:

cur.execute("update tablenew set status = ? where id IN ?", ('new', list))
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.