简体   繁体   中英

sqlite3.OperationalError: near “,”: syntax error python

I know this is a repeated question and I've looked at all of them however I cant see what I'm doing wrong.

this is my sqlite3 code:

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

and get the error:

sqlite3.OperationalError: near ",": syntax error

where am I going wrong?

A DELETE statement doesn't take any VALUES section. See the DELETE documentation :

删除语法

You need to build a boolean expression for your WHERE clause:

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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM