How to count totals for each unique name in a table?

hello, i am having trouble on how to implement this. i have a table of
doctor information where each doctor has a town and county field. i
would like to create a view that shows the amount of doctor_types in
each town. For example

if the user selects the ‘General Doctors’ search button, a view like
this will show up. The next step would be for the user to select which
county or town the user would like to view.

Viewing General Doctor: Select which county or town you would like to
see.
*the names are active links that will grab the doctor type locating in
town

County - Camden(10)
Towns - Cherry Hill(3) , Marlton(2), Mount Holly (5), etc…

County - Burlington(5)
Towns - Mount Laurel(2), Moorestown(0), Clementon(3), etc…

etc…

so basically it seems that there needs to be another model with a county
has_many towns relationship and somehow relate that to the doctor info
table. So i am guessing i will have a hash of some sort, grab the first
county in the county table and then get towns == county_id AND in the
doctor_type table, count the amount of doctor_types where Town ==
current town in interation loop. Afterwards, move unto the next hash
space for the next county and repeat. etc…

so its like i may have to create an array of hashes?!?!!

now that i think about it somemore, it may just be easier if i create a
total table that contains a doc_id field doc_type_id, county_id,
town_id, and a interger total. that way, i can just count how many
instances there are of doc_types and towns.