Results 1 to 2 of 2
  1. #1
    Join Date
    Feb 2013
    Posts
    3

    Unanswered: SQL query trouble

    Hello everyone!

    I have a little problem that I am having trouble figuring out.

    In my Access database, I have a table of customers. The fields are as follows:

    FirstName | LastName | Address | City | State | Zip | Zip4 | Phone | Product

    Now this is what I want to do with this information. I am trying to do specific marketing to customers. The information I want to retrieve is out of all the customers, how many unique zip codes do I have and a count of how many unique customers per each unique zip code.

    I know I can do:
    SELECT DISTINCT customers.Zip
    FROM customers

    However, this only returns the unique zip codes, and doesn't give me a count of how many customers I have in each of those zip codes.

    I know SQL has a count feature, but how would I go about applying it to something like this?

    Any help would be greatly appreciated.

    Thanks in advance!

  2. #2
    Join Date
    Dec 2012
    Location
    Logan, Utah
    Posts
    163
    Something along the lines of:

    Code:
    SELECT Zip, Count(*)
      FROM  Customers
     GROUP BY Zip
    should do it.

Posting Permissions

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