Home > Mobile >  AND operator doesn't work in python sqlite3 [closed]
AND operator doesn't work in python sqlite3 [closed]

Time:10-06

I am trying to use a DELETE WHERE clause with AND but it does not work.

example:

 db.execute("DELETE FROM res WHERE court = ? AND resTime = ?", (court_delete, dateTime))

When I use either one it works but not both. What am I doing wrong?

CodePudding user response:

It's just that your SQL doesn't have the record you want to delete.

CodePudding user response:

If you want a single query which does the same work as two queries:

DELETE FROM res WHERE resTime = ?

and

DELETE FROM res WHERE court = ? 

then you want OR

DELETE FROM res WHERE court = ? OR resTime = ?

CodePudding user response:

Turn out it was a bug with the vars I compared in the query, Sorry for wasting your time guys.

  • Related