sqlite3.OperationalError:靠近“,”:语法错误python

2024-10-02 16:27:27 发布

您现在位置:Python中文网/ 问答频道 /正文

我知道这是一个重复的问题,我看了所有的问题,但我看不出我做错了什么。在

这是我的sqlite3代码:

cursor.execute('''DELETE FROM dates WHERE (Date, Start, End) VALUES( ? , ? , ? );''',
               (fulldaterem, starttimehour2, endtimehour2)) 

然后得到错误:

^{pr2}$

我哪里出错了?在


Tags: 代码fromexecutedatewheredeletestartsqlite3
1条回答
网友
1楼 · 发布于 2024-10-02 16:27:27

DELETE语句不包含任何VALUES部分。参见^{} documentation

DELETE grammar

您需要为WHERE子句构建一个布尔表达式:

cursor.execute(
    '''DELETE FROM dates
       WHERE Date=? AND Start=? AND End=?''',
    (fulldaterem, starttimehour2, endtimehour2)) 

相关问题 更多 >