Home > OS >  How to use a Case When Statement to Count a Count Column
How to use a Case When Statement to Count a Count Column

Time:06-27

SELECT DISTINCT f.location_name, COUNT (*) AS COUNT
FROM fastfood
GROUP BY f.location_name;

Hi, What I want to do is count the Count column, so I can see specifically how many locations have a count of one, how many locations have a count of 2, etc. Can someone assist? Thank you!

CodePudding user response:

SELECT counter,count(*) how_many FROM (
  SELECT location_name, COUNT(*) AS COUNTER
  FROM fastfood 
  GROUP BY location_name
) a GROUP BY counter
  • Related