This table is updated whenever a customer buys anything:
table 1
- customerid
- item
I want to find out a query to know the frequency distribution of number of customers and number of items bought. For example the number of customers who have bought 1 item, 2 items and so on.
Something like this should do the trick:
First you group by
customeridto get your counts and then group by the counts to get your histogram values. This will give you the number of items bought initems_boughtand the number of customers that bought that many incustomers.