Zip Count

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • gjpr75
    New Member
    • Feb 2012
    • 2

    Zip Count

    I have a table of zip codes and a label list zip codes table.

    example of tables:

    Label List zip code Table

    zipcode labelzip
    01960 01960
    01961 01960
    01962 01962
    01963 NA

    Zip Codes Table

    ID Zipcode
    1 01960
    2 01960
    3 01961
    4 01962
    5 01962
    6 01963
    7 01963

    I need a query that would give me the following results:

    Zipcode Count
    01960 3
    01962 2
    01963 2

    Any ideas?
  • Rabbit
    Recognized Expert MVP
    • Jan 2007
    • 12517

    #2
    I don't know how you get from your sample data to your results. 01961 disappeared from your results and the counts look wrong.

    But however, you're doing your count, you're probably looking for an aggregate query.

    Comment

    • gjpr75
      New Member
      • Feb 2012
      • 2

      #3
      Rabbit,

      The label zip tells me what zips i can group. For instance 01960 and 01961 can be counted under the zip 01960. So the counts includes 2 01960 and 1 01961 to equal 3 total for 01960. But not all zips can be grouped so they dont appear in my label zip list, like zip 01963. But i still want to count 01963 which is from the zip codes table. Does that make sense? Thanks!

      Comment

      • Rabbit
        Recognized Expert MVP
        • Jan 2007
        • 12517

        #4
        Like I said earlier, use an aggregate query.

        Comment

        Working...