0

I need to delete entries in my SQLite DB where all Values match.

So I create the entry like that:

    # Insert a row of data
    c.execute("insert into Database (Value1, Value2, Value3, Value4, Value5, Value6) values (?, ?, ?, ?, ?, ?)",
            (d1, d2, d3, d4, d5, d6))

And later on i will delete the exact entry by its values. I tried it like that:

    c.execute("delete from Database where (Value1, Value2, Value3, Value4, Value5, Value6) values (?, ?, ?, ?, ?, ?)",
            ("String1", "String2", "String3", "String4", "String5", "String6"))

But i get this: OperationalError: near "values": syntax error

How do I delete a SQLite entry with multiple values matching?

1 Answer 1

2

You have to write the full SQL condition:

c.execute('delete from Database where Value1=? and Value2=? and Value3=? and Value4=? and Value5=? and Value6=?',  ("String1", "String2", "String3", "String4", "String5", "String6"))

You can learn the full syntax here.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.