Reputation: 875
I am trying to delete specific rows in a database table where specific conditions are not met. This is the SQL command:
DELETE FROM table WHERE URL NOT LIKE "%/meldung/%" or NOT LIKE "%/artikel/%"
I want to delete every row in the URL column which does not contain /meldung/ or /artikel/, but this command just keeps the rows which contain /artikel/ AND /meldung/ in the URL.
Somebody can help?
Upvotes: 0
Views: 72
Reputation: 32003
try like below you missed column name after or
DELETE FROM table WHERE URL NOT LIKE "%/meldung/%" and
URL NOT LIKE "%/artikel/%"
Upvotes: 0
Reputation: 1037
You use either
DELETE FROM table WHERE not(URL LIKE "%/meldung/%" or URL LIKE "%/artikel/%")
or
DELETE FROM table WHERE (URL not LIKE "%/meldung/%" and URL not LIKE "%/artikel/%")
Upvotes: 1