ventesites Posted October 3, 2016 Share Posted October 3, 2016 hi I am stuck trying to find the right query to select all registered customers who never placed an order... I use this query select c.id_customer, c.firstname, c.lastname, count(o.id_order) as ordercntfrom ps_customer cleft join ps_orders o on c.id_customer = o.id_customergroup by o.id_customer but it doesn't return what i want Any help? Thanks Pat Link to comment Share on other sites More sharing options...
Logical IT Posted October 3, 2016 Share Posted October 3, 2016 Hello, Try this: SELECT firstname, lastname, email, date_add, activeFROM ps_customerWHERE NOT EXISTS (SELECT ps_orders.id_customer FROM ps_orders WHERE ps_orders.id_customer = ps_customer.id_customer) 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