我有表「table_film」和列「film_cat」,如下刪除除某些標識以外的所有記錄?
我想刪除film_cat除ID 4,9,114,131所有ID圖片(不包括在同一時間4號,也許,4,9, - ,4,114, - ,4,9,131,...)
我試過但沒有工作!
DELETE FROM `table_film` WHERE id NOT IN (SELECT * FROM table_film WHERE film_cat = '4' or film_cat='9' or film_cat='114' or film_cat='131')
DELETE FROM table_film where film_cat NOT IN (4,9,114,131)
DELETE FROM table_film WHERE film_cat != '4,9,114,131'
film_cat –
的數據類型是什麼?考慮通過添加另一個關係,比如'table_film_categories'和多對一關係(許多'films'給任何給定的'category')來規範化表。 – mbaitoff