Results 1 to 7 of 7
  1. #1
    fekrinejat is offline Novice
    Windows 7 32bit Access 2010 32bit
    Join Date
    Jan 2013
    Posts
    29

    Problem with create a query on a table

    Hi
    there is a table with these fields :

    1- Name
    2- City (contains cities name)
    3- Marital Status (contains: Single - Married - Divorced)

    Now what would be my Query for counting
    each status in each specific city ?


    for example i need this result:

    City A ----> Single = 20
    City A ----> Married = 40
    City A ----> Divorced = 10
    City B ----> Single = 27
    City B ----> Married = 46
    City B ----> Divorced = 5
    .
    .
    .
    Thanks in advance

  2. #2
    orange's Avatar
    orange is offline Moderator
    Windows XP Access 2003
    Join Date
    Sep 2009
    Location
    Ottawa, Ontario, Canada; West Palm Beach FL
    Posts
    16,848

  3. #3
    fekrinejat is offline Novice
    Windows 7 32bit Access 2010 32bit
    Join Date
    Jan 2013
    Posts
    29
    I would like to know, how many people in each city has what situation ?

    for example :

    I expect the result just tells me in City "A" there are 20 People who are single and in City "B" there are 46 people who are married and etc ..

    I can use GroupBy to get for example : there are 100 people in city "A" but i cann't separate them by their situations as well ...

    A simple question
    any idea ?

  4. #4
    orange's Avatar
    orange is offline Moderator
    Windows XP Access 2003
    Join Date
    Sep 2009
    Location
    Ottawa, Ontario, Canada; West Palm Beach FL
    Posts
    16,848
    Something like

    SELECT City, MartialStatus, Count(Name)
    FROM YourTableName
    Group By City,MaritalStatus

    Try it see if we're close.

  5. #5
    fekrinejat is offline Novice
    Windows 7 32bit Access 2010 32bit
    Join Date
    Jan 2013
    Posts
    29
    Thanks , that helped ..

  6. #6
    orange's Avatar
    orange is offline Moderator
    Windows XP Access 2003
    Join Date
    Sep 2009
    Location
    Ottawa, Ontario, Canada; West Palm Beach FL
    Posts
    16,848

  7. #7
    fekrinejat is offline Novice
    Windows 7 32bit Access 2010 32bit
    Join Date
    Jan 2013
    Posts
    29
    Yes indeed i did , had told you a simple question for you ..
    Thanks anyway

Please reply to this thread with any new information or opinions.

Similar Threads

  1. Replies: 3
    Last Post: 04-27-2012, 08:34 AM
  2. create table using something like loop query
    By learning_graccess in forum Queries
    Replies: 20
    Last Post: 04-18-2012, 09:52 AM
  3. Replies: 2
    Last Post: 12-20-2011, 07:33 AM
  4. Replies: 1
    Last Post: 12-16-2011, 08:16 AM
  5. Create table out of union query
    By DKruse1969 in forum Queries
    Replies: 2
    Last Post: 08-28-2009, 09:55 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Other Forums: Microsoft Office Forums