Reputation: 13
I know i can select all rows that contain non-english characters using below query:
SELECT * FROM user WHERE NOT username REGEXP '[A-Za-z0-9]';
How can I delete them using a single query now?
My results are more than 15000 rows so I can't select and drop them 30 by 30 takes so much time.
Upvotes: 0
Views: 134
Reputation: 24953
If a SELECT
statement finds the rows you're looking for, in most cases you can delete the part before the FROM
and replace it with DELETE
.
With your example, this would be
DELETE FROM user WHERE NOT username REGEXP '[A-Za-z0-9]';
Upvotes: 1