coder188642
coder188642

Reputation: 145

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?

Upvotes: 0

Views: 930

Answers (1)

Martijn Pieters
Martijn Pieters

Reputation: 1123400

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

DELETE grammar

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

Upvotes: 3

Related Questions