I have 3 tables - Customer Info
(Customer_ID, Name, State, Income
), Product Info
(Product_ID, Product_Name, Price
) & Sales Info
(Customer_ID, Purchase_Date, Quantity, Store_ID
).
I am trying to list every customer (Customer_Info.Name)
and count for the products they bought. The columns are all the products available for sale. I can do a count with a select for each of the product ID manually but I'm trying to avoid that.
The output will look something like
Name | Product1 | Product2 | Product3 | Product4 .......
AAA. | 1. | NULL. | 2. | 1. .......
....