Dave123 Dave123 - 1 year ago 63
Python Question

How to delete record from table where field is equal to header?

I have a sqlite table which contains duplicate headers which I would like to remove. This is my current statement.


This statement, when executed, deletes the entire table.

Answer Source

Don't use double quotes for strings!

delete from table where field = 'field';

The SQL standard for string delimiters is single quotes. Sometimes double quotes are used, but they are also used as escape characters for column names. So your code was just where field = field and that deletes all non-NULL values.

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download