sampsonzak Posted January 15, 2020 Share Posted January 15, 2020 Hi all, looking to see if anyone knows how I could easily list all customers email addresses with 3 or more orders? With the customer export, this only shows 'total sales' rather than 'total orders' so I cannot use that. Does anyone have any idea? Any neat SQL code that would do this for me? I have tried looking into the MySQL database, but ps_customers does not have any 'orders' or 'purchases' field/value, so I have no clue how to do this. Would appreciate any help. Thanks alot! To get these email addresses exported into a text file would also be AMAZING if anyone could spare a few minutes and help me out on this. Thanks!! Link to comment Share on other sites More sharing options...
tomerg3 Posted January 15, 2020 Share Posted January 15, 2020 Here's a quick one with the order count (not filtering order by their status in any way) SELECT c.id_customer, c.email, (SELECT COUNT(*) FROM ps_orders o WHERE o.id_customer = c.id_customer) AS order_count FROM ps_customer c WHERE 3 < (SELECT COUNT(*) FROM ps_orders o WHERE o.id_customer = c.id_customer) 1 Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now