DELETE ALL EXCEPT x
Posted: Thu Jul 13, 2006 6:36 pm
How would I (and this is just hypothetical) delete all from database where user_id != 1, 2, 3, 5, or 6
A community of PHP developers offering assistance, advice, discussion, and friendship.
http://forums.devnetwork.net/
Code: Select all
delete from `users` where `user_id` != 1 and `user_id` != 2 and `user_id` != 3 and `user_id` != 4 and `user_id` != 5 and `user_id` != 6;
Code: Select all
DELETE FROM `users` WHERE `user_id` NOT IN (1, 2, 3, 5, 6 )The Ninja Space Goat wrote:how do you make that SQL box like astions did? I tried [sql] and it didn't work.
Code: Select all
neat!