This is a discussion on Delete multiple rows in one go !! ?? within the MySQL forums, part of the Database Server Software category; --> This is on a PHPBB forum, but I'm looking at running this as an SQL Query if possible.. I've ...
| |||||||
| FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read |
| ||||
| This is on a PHPBB forum, but I'm looking at running this as an SQL Query if possible.. I've been validating the email addresses of my users and now want to delete some accounts based on non validated email addresses... So I have a list of address: account1@domain1.com account2@domain2.com account3@domain3.com ETC... Any way to delete the users based on a list like above ?? I have about 400 email addresses.. Thanks |
| |||
| <jerryyang_la1@yahoo.com> wrote in message news:1174467375.239943.28020@b75g2000hsg.googlegro ups.com... > This is on a PHPBB forum, but I'm looking at running this as an SQL > Query if possible.. > > I've been validating the email addresses of my users and now want to > delete some accounts based on non validated email addresses... > > So I have a list of address: > > account1@domain1.com > account2@domain2.com > account3@domain3.com > > ETC... > > Any way to delete the users based on a list like above ?? I have about > 400 email addresses.. > > Thanks > How are you validating the addresses? I used to have a contacts list, which I would periodically check (on a webpage). Checkboxes were used to add a value to the "OBSOLETE" column that I had created. Then DELETE FROM CONTACTS WHERE OBSOLETE <> "" Later, I decided to keep the invalid ones and then add functionality to the pages that would prevent that email address from being used. So where I wanted a list of my contacts: SELECT * FROM CONTACTS WHERE OBSOLETE = "" Hope you can find something useful there. |
| |||
| On 21 Mar, 08:56, jerryyang_...@yahoo.com wrote: > This is on a PHPBB forum, but I'm looking at running this as an SQL > Query if possible.. > > I've been validating the email addresses of my users and now want to > delete some accounts based on non validated email addresses... > > So I have a list of address: > > accou...@domain1.com > accou...@domain2.com > accou...@domain3.com > > ETC... > > Any way to delete the users based on a list like above ?? I have about > 400 email addresses.. > > Thanks You can put the email addresses into their own table and use a JOIN to drive the deletes. |
| |||
| Thanks I've exported the email addresses into a text file, validated them and know have a list of known bad addresses. Can you explain "You can put the email addresses into their own table and use a JOIN to drive the deletes. " Or any other options ?? Thanks |
| |||
| On 21 Mar, 16:01, jerryyang_...@yahoo.com wrote: > Thanks > > I've exported the email addresses into a text file, validated them and > know have a list of known bad addresses. > > Can you explain > "You can put the email addresses into their own table and use a JOIN > to > drive the deletes. " > > Or any other options ?? > > Thanks Suppose in your `accounts` table the email column is called `email`, you could put all the email addresses that you want deleted in another table called `bademails` and we'll call the column `emal` again. Then you can use the multi table delete syntax JOINing the 2 tables. Or of course you could change your list into the contents of an IN set. |
| ||||
| On 21 Mar, 16:23, "Captain Paralytic" <paul_laut...@yahoo.com> wrote: > On 21 Mar, 16:01, jerryyang_...@yahoo.com wrote: > > > Thanks > > > I've exported the email addresses into a text file, validated them and > > know have a list of known bad addresses. > > > Can you explain > > "You can put the email addresses into their own table and use a JOIN > > to > > drive the deletes. " > > > Or any other options ?? > > > Thanks > > Suppose in your `accounts` table the email column is called `email`, > you could put all the email addresses that you want deleted in another > table called `bademails` and we'll call the column `email` again. > > Then you can use the multi table delete syntax JOINing the 2 tables. > > Or of course you could change your list into the contents of an IN set. Example of multi table delete: DELETE FROM `accounts` USING `accounts` JOIN `bademails` USING(`email`) |