Search code examples
mysqlsqlphpmyadminbulk

Bulk user delete with same email


I want to delete all users who have the email address of @trash-mail.com

How can I do that with a SQL? I'm trying this

DELETE from users    
WHERE email LIKE %trash-mail.com

But it's not working and I really need to be able to delete mass accounts.


Solution

  • You forgot quotes:

    DELETE FROM users    
    WHERE email LIKE '%trash-mail.com'
    

    See http://www.techonthenet.com/sql/like.php for more information on the LIKE condition.