Reputation: 47196
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,));
Upvotes: 2
Views: 2008
Reputation: 38603
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))
Upvotes: 0
Reputation: 30595
INSERT does not have a WHERE clause. I think you mean UPDATE.
Upvotes: 4