Skip to content
Advertisement

Identifying products that a customer owns

I want to check whether my customer owns an iPhone, iPad, or Macbook. I am not looking for how many iPhone or iPad or Macbook one customer has, I just want to identify if they own any of them, or if they own any two, or if they own all three.

I am thinking of using the CASE WHEN function and here is the query:

This is the result that I am trying to get

But this is what I am getting instead

Advertisement

Answer

You are looking for conditional aggregation. I would phrase your query as:

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