SQL query to delete users with multiple meta keys and comments

So i got the answer and solution here https://stackoverflow.com/questions/55142768/sql-for-wp-to-delete-users-with-multiple-meta-keys-and-comments/55142835#55142835 SELECT u.* FROM wp_users u WHERE NOT EXISTS (SELECT 1 FROM wp_usermeta um WHERE u.ID = um.user_id AND um.meta_key IN (‘metakey1’, ‘metakey2’) ) AND NOT EXISTS (SELECT 1 FROM wp_comments c WHERE u.ID = c.user_id );

WordPress filter from custom table is not working properly

First of all, you should never build SQL queries like you do – concatenating SQL with raw variables is insecure and it causes SQL Injection vulnerabilities. You should always prepare all queries. As for the main part of question… You use AND operator in your query, so it will retrieve only rows, that will satisfy … Read more

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)