May 26, 2009 at 9:32 am
Ive got about 600 accounts that I need to delete from the database but every time i try to delete multiple accounts at a time i get an error message or it doesnt affect any rows.
ive tried
DELETE FROM Member
WHERE Email = 'email@email.com, email2@email.com'
which doesnt do anything
DELETE FROM Member
WHERE Email = 'email@email.com' AND 'email2@email.com'
etc
any tutorials or examples that show me how to delete multiple rows in a single table?
id rather write out a decent sized query then have to go through and write a query for each..
May 26, 2009 at 9:51 am
try
DELETE FROM Member
WHERE Email in ( 'email@email.com' , 'email2@email.com')
May 26, 2009 at 9:57 am
awesome that works, thanks.
May 26, 2009 at 10:08 am
If you have the list of accounts available in a table, you could alter your syntax to:
DELETE FROM Member
WHERE Email IN (SELECT Account FROM AccountTable);
If you have this list in Excel - you can import it to a table so you can use the above instead of typing in all 600 manually.
Jeffrey Williams
“We are all faced with a series of great opportunities brilliantly disguised as impossible situations.”
― Charles R. Swindoll
How to post questions to get better answers faster
Managing Transaction Logs
May 26, 2009 at 10:40 am
Thanks, next time ill be sure to do the excel import table way so i dont have to do a huge query.
Viewing 5 posts - 1 through 5 (of 5 total)
You must be logged in to reply to this topic. Login to reply
This website stores cookies on your computer.
These cookies are used to improve your website experience and provide more personalized services to you, both on this website and through other media.
To find out more about the cookies we use, see our Privacy Policy