Created
March 8, 2023 10:32
-
-
Save attilabacso/5b0229662c83c238da9e1aec3c009a84 to your computer and use it in GitHub Desktop.
SELECT ALL USERS WITH NO BILLING FIRST NAME IN WOOCOMMERCE
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
-- SELECT ALL USERS WITH NO BILLING FIRST NAME IN WOOCOMMERCE | |
SELECT * | |
FROM wp_users AS wpu | |
INNER JOIN wp_usermeta wpum | |
ON wpum.user_id = wpu.ID | |
WHERE wpu.ID IN ( | |
SELECT wp_users.ID | |
FROM wp_users | |
WHERE NOT EXISTS ( | |
SELECT 1 | |
FROM wp_usermeta | |
WHERE meta_key = 'billing_first_name' | |
AND user_id = wp_users.ID | |
) | |
AND wp_users.user_registered > '2021-01-01' | |
AND wp_users.ID NOT IN ('1079', '271') | |
) | |
GROUP BY wpu.ID |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment