We help IT Professionals succeed at work.
Get Started

Finding Customers who made a purchase and customer who did not make a purchase

fb1990 asked
Last Modified: 2020-01-19
Hello EE,

Can someone please help me with a SQL code to get a list of customers who purchased at least 1 item in a giving month and customers who did not make a purchase in that same month? I want to show 1 for customers who made a purchase and 0 for customers who did not make a purchase.  I have 2 tables - a customer table and an order table.  The customer table contains all the customers while the order table contains only the customer who made a purchase in any giving month.  In my case, I want to show customers who made a purchase in the month of January 2020 customers who did not.

Both tables have the customer as an identifier while the orders table contains customerno, ordercount, and orderdate
Watch Question
Distinguished Expert 2020
This problem has been solved!
Unlock 1 Answer and 4 Comments.
See Answer
Why Experts Exchange?

Experts Exchange always has the answer, or at the least points me in the correct direction! It is like having another employee that is extremely experienced.

Jim Murphy
Programmer at Smart IT Solutions

When asked, what has been your best career decision?

Deciding to stick with EE.

Mohamed Asif
Technical Department Head

Being involved with EE helped me to grow personally and professionally.

Carl Webster
CTP, Sr Infrastructure Consultant

An Experts Exchange subscription includes unlimited access to online courses.

Get Started
Ask ANY Question

Connect with Certified Experts to gain insight and support on specific technology challenges including:

  • Troubleshooting
  • Research
  • Professional Opinions
Did You Know?

We've partnered with two important charities to provide clean water and computer science education to those who need it most. READ MORE