SQL Help Needed

Results 1 to 3 of 3

Thread: SQL Help Needed

  1. #1
    Join Date
    Dec 1969

    Default SQL Help Needed

    i have a table with a 1000 zip codes in it.<BR><BR>Table = StormZip03<BR>Field = ZIP<BR><BR>i would like to create a query in access 2000 that will list each of the zip codes listed in the table followed by the number of times that zip code appears. any help? thanks in advance!

  2. #2
    Join Date
    Dec 1969

    Default Easy Peesy

    You should really learn SQL! This is basic stuff<BR><BR>Select Zip, count(zip) as ZipCount From StormZip03 Group BY Zip ORDER BY Zip

  3. #3
    Join Date
    Dec 1969

    Default RE: SQL Help Needed

    Let me take a stab at this off the top of my head...<BR>I&#039;m sure it can be done in one step, but I know how to do it in two....<BR><BR>SELECT DISTINCT ZIP FROM StormZip03;<BR><BR>.... will give you each of the zip codes... (only one time each)<BR><BR>... if you want to COUNT how many DIFFERENT zip codes there are you would do something like...<BR><BR>SELECT DISTINCT ZIP, COUNT(ZIP) As Count FROM StormZip03;<BR>... the number of distinct zip codes would come back in the variable "Count".<BR>... To do a count of each of the groups of zipcodes (for example, how many in zip code 12345), you would do<BR><BR>SELECT COUNT(ZIP) AS Count FROM StormZip03 WHERE ZIP=&#039;12345&#039;;<BR><BR>... Don&#039;t know how to do the above for the whole set, other than nesting....<BR><BR>--Greg

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts