Created
July 19, 2017 01:18
-
-
Save JackScottAU/6fc19671008be78fd7dfc45988138e48 to your computer and use it in GitHub Desktop.
Get Customer Emails from 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 meta_value AS email, COUNT(meta_value) AS orders | |
FROM wp_postmeta INNER JOIN wp_posts ON wp_posts.ID = wp_postmeta.post_id | |
WHERE wp_posts.post_type = 'shop_order' AND wp_postmeta.meta_key = '_billing_email' | |
GROUP BY meta_value | |
ORDER BY COUNT(meta_value) DESC; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment