开发者

sqlite python insert with where condition

开发者 https://www.devze.com 2022-12-18 00:39 出处:网络
from this post sqlite python insert I learned inserting into tables but开发者_运维问答 now I need to use where something like

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

精彩评论

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

关注公众号