I want to get customers list that didn't bought in last X months in magento 1 or 2?


Last 12 months

Last 9 months

Last 20 months

Last 36 months

  • 1
    Filter the sales/order collection with the date range and get all the unique customer_ids. And then filter the customer collection with condition not in customer_ids. Commented Jun 22, 2018 at 4:50
  • Do you need SQL query for that? Commented Jun 22, 2018 at 5:02
  • I need collections of customers. Commented Jun 22, 2018 at 5:08

1 Answer 1


in database of magento 2 there is a table ## sales_order ## from there you take the customer details.

  • That is not a good idea. The customer can visit the site without placing order. Commented Jun 22, 2018 at 4:29
  • @AthulVijayan sorry its my mistake . you can actually take details from sales_order table Commented Jun 22, 2018 at 4:36

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.