sqlite python insert with where condition
from this post sqlite python insert I learned inserting into tables but开发者_运维问答 now I need to use where something like
cursor.execute("insert into table1(id) values (?) where ip=? and address=?",(id,),(ip,),(addr,));
INSERT does not have a WHERE clause. I think you mean UPDATE.
You can't use a WHERE
clause in an INSERT
. If you want to specify the values for particular fields to insert, put them in the values clause:
cursor.execute("INSERT INTO table1(id, ip, address) VALUES (?, ?, ?)", (id, ip, addr))
精彩评论