I have this table
|model size color customer|
|ip4g 8 black Boy |
|ip4g 8 white Boy |
|ip4g 16 white Girl |
|ip4g 16 black Girl |
I know how to query the count by
Select model, size, color, count(*) from table group by model, size, color;
What I need is to generate an excel table looking like this.
I don't know how I will be able to produce the count which is = 0 and the per customer.
I made a table with all the possible combinations. Then did this query :
select x.model, x.size, x.color, sum(y.customer), count(y.*)
from table x left join table y on x.model = y.model
and x.size = y.size and x.color = y.color group by
x.modelname, x.size, x.color;
I got data fewer than expected. Then, I also need to show all the customers, and the number of customers may vary.
Please help. Thanks.