Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save attilabacso/5b0229662c83c238da9e1aec3c009a84 to your computer and use it in GitHub Desktop.
Save attilabacso/5b0229662c83c238da9e1aec3c009a84 to your computer and use it in GitHub Desktop.
SELECT ALL USERS WITH NO BILLING FIRST NAME IN WOOCOMMERCE
-- 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