Skip to content
Advertisement

Count of all occurrences on all rows

I need to complete an overall count of occurrences of one column and all rows.

As an example of data:

enter image description here

How many times the place has occurred.

I’ve done this so far which counts the years but how do I then do a count on that count

SELECT year,count(year)
from
countries group by place-name

So how do I now count my places by the year counts? For example Birkenhead would equal 7

Advertisement

Answer

Try

select DISTINCT(place-name), count(*) 
from 
countries group by place-name
User contributions licensed under: CC BY-SA
8 People found this is helpful
Advertisement