开发者

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))
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜