COUNTING the instances of various values in a Single Field.

  • Thread starter Thread starter kev100 via AccessMonster.com
  • Start date Start date
K

kev100 via AccessMonster.com

This seems like it should be really simple....I'm still learning Access and
can't quite get it. I've searched for the process, but those I've found all
seem slightly different.

I've simply got a table with a few 100 records.

One of the fields in each record is CITY.

The city name could be just about anything.

I'm needing a query to produce a count of all the instances. The end result
would, ideally, be something like:

Town Total Instances
Columbus 345
Brownsville 53
Greenville 110
Middlesville 89
etc...

Would this just be some various of SUM() ?...other?

Thanks very much.
 
kev100 said:
This seems like it should be really simple....I'm still learning Access and
can't quite get it. I've searched for the process, but those I've found all
seem slightly different.

I've simply got a table with a few 100 records.

One of the fields in each record is CITY.

The city name could be just about anything.

I'm needing a query to produce a count of all the instances. The end result
would, ideally, be something like:

Town Total Instances
Columbus 345
Brownsville 53
Greenville 110
Middlesville 89
etc...

Would this just be some various of SUM() ?...other?

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

If all your criteria is listed in your post the query would look like
this:

SELECT Town, Count(*) As Total_Instances
FROM table_name
GROUP BY Town

--
MGFoster:::mgf00 <at> earthlink <decimal-point> net
Oakland, CA (USA)

-----BEGIN PGP SIGNATURE-----
Version: PGP for Personal Privacy 5.0
Charset: noconv

iQA/AwUBRKViiYechKqOuFEgEQLBGQCg2NKADUxd6PBTkcgv/fnoyjwnsyoAnjK+
EsJRXUoUUJK1Myv+7qIqT3ym
=JVz9
-----END PGP SIGNATURE-----
 
In my experience with Access (2002), it doesn't like to count *'s

If MGFoster's query doesn't work for you, the try it like this:

SELECT Town, Count(Town) As Total_Instances
FROM table_name
GROUP BY Town

Hope this helps,

Conan Kelly
 
Back
Top