Home > database >  Number of members consumption
Number of members consumption

Time:09-22

I want to know, each store one member of the spending, two how many, how much spending more than three times, then respectively the total consumption quantity and amount for the number of
Each time there will be a single number, record the member number and consumption

CodePudding user response:

 SELECT shops, 
T.,
COUNT (1) AS the number of
The FROM
(SELECT shops, membership number, COUNT (1) AS the number of the FROM table GROUP BY shops, members) t
GROUP BY shops,
T. number;
  • Related