2015-11-26 60 views

回答

5

你可以試試這樣

RestoFoods::deleteAll(['AND', 'restaurant_id = :restaurant_id', ['NOT IN', 'food_id', [1,2]]], [':restaurant_id' => $postData['resto_id']]); 

輸出,用於這將是你想要的:

DELETE FROM `resto_foods` WHERE (restaurant_id = 1) AND (`food_id` NOT IN (1, 2));