Page 1 of 1

Deleting everything EXCEPT ...

Posted: Thu Aug 29, 2002 8:38 pm
by phice
What's the query line to DELETE * FROM table WHERE id DOES NOT EQUAL 164


something like that...

Posted: Thu Aug 29, 2002 9:04 pm
by fatalcure

Code: Select all

$query="DELETE FROM table WHERE id <> 164";
mysql_query($query);

Posted: Fri Aug 30, 2002 6:40 pm
by phice
even if you have charectors inside the EXCEPT value?

like... would "DELETE FROM table WHERE name <> their_name184" work?

Posted: Fri Aug 30, 2002 9:08 pm
by fatalcure
yea, it should:

DELETE FROM table WHERE name <> 'user_name'