At 12:29 -0500 7/18/03, Tom O'Neill (MySQL User) wrote:
Hi,

Is there a way I can run a query that will delete all items that are not in
a list?  For example I have a bunch of records in a table and I want to
remove all of them that are not in a comma delimited list that I have
recieved from another application.  I was thinking that I could create a
query that says:

WHERE id != 'item1' AND id != 'item2'  AND id != 'item3'... etc but I was
wondering if there is an easier/more effecient way?

Thanks!

-Tom

... WHERE id NOT IN('item1','item2','item3',....)


You cannot use NULL in the value list.

--
Paul DuBois, Senior Technical Writer
Madison, Wisconsin, USA
MySQL AB, www.mysql.com

Are you MySQL certified? http://www.mysql.com/certification/


-- MySQL General Mailing List For list archives: http://lists.mysql.com/mysql To unsubscribe: http://lists.mysql.com/[EMAIL PROTECTED]



Reply via email to