Reputation: 1046
I have a bunch of WordPress users that I'd like removed in the wp_users table. The query I want to run is:
DELETE FROM `wp_users` WHERE `user_registered` > '2010-08'
However, there are also a crap load of rows I want removed from wp_usermeta, where the column user_id
matches the above query. How can I delete the related rows in wp_usermeta at the same time?
Upvotes: 0
Views: 10861
Reputation: 4200
DELETE FROM `wp_usermeta`
WHERE `wp_users`.`user_registered` > '2010-08'
AND `wp_users`.`user_id` = `wp_usermeta`.`user_id`
Replace user_id according your database schema
Upvotes: 2