Delete more that one customer at a time ?

S

SpookiePower

I have this SQL

Delete * from table
where customernumber = 153

And now I need to delete more that 200 customers from my table.
Insted of running the SQL 200 times, I have tryed to write the SQL
like this -

Delete * from table
where customernumber = 153,248,457,789..........

But I get and error that says that I'm missing a "," sign.....but
where ???
 
J

John Spencer

DELETE
FROM Table
WHERE CustomerNumber in (153,248,457,789,...)

However that won't let you handle 200 at one time.

Is there a table somewhere that has the numbers you need to delete or is
there some criteria you can use to identify the customer numbers you
want to delete?

If nothing else, I would create a table with one field and enter the
customer numbers in the field - one number per record. Then you could
enter all the customer numbers as records and use

DELETE
FROM Table
WHERE CustomerNumber in
(SELECT CustomerNumber
FROM MyDeleteTheseTable)



'====================================================
John Spencer
Access MVP 2002-2005, 2007-2008
Center for Health Program Development and Management
University of Maryland Baltimore County
'====================================================
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top