0

Hi, I need to drop tables from a database where all the email addresses end in the same domain,
ie, say I have 1000 email addresses i need to input an MYSQL query to delete all rows containing email addresses ending with @mydomain.co.uk.

Does anyone know how to do this?

3
Contributors
2
Replies
20
Views
2 Years
Discussion Span
Last Post by diafol
0

WHy do you need to drop a table? It sounds like you just need to delete records from that table. For deleting specific email address domains:

DELETE FROM `mytable` WHERE `email` LIKE '%@mydomain.co.uk'

If you do this, then remember if you have any related records in other tables that these are also deleted - use CASCADE:

http://www.mysqltutorial.org/mysql-on-delete-cascade/

//EDIT - prit - was writing as you posted, heh heh.

Edited by diafol

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.