Skip to content
Advertisement

SQL Count all null values as distinct [closed]

I need to write a query that tells me how many(COUNT) unique customers made a purchase of over $200. My table has a customer_id, purchase_id, and total. purchase_id is unique for every row. Customer_id can repeat, and also have null values.

A “unique customer is considered a unique customer_id or a null customer_id. So in the list:

There would be 5 unique customers.

Advertisement

Answer

User contributions licensed under: CC BY-SA
10 People found this is helpful
Advertisement