Results 1 to 3 of 3
  1. #1
    RCinSTP is offline Novice
    Windows XP Access 2003
    Join Date
    Apr 2014
    Posts
    2

    Access 2003 query GroupBy and Count plus need total count

    I have a table with States MN and WI and each state lists how many Red apples and how many Green apples. The SQL below shows, for example, MN has 3 green and 4 red, and state WI has 3 green and 6 red. How can I see the total number of apples? 3 + 4 + 3 + 6 = 16 Can I show the total 16 in my query or do I need to use a Report? I could not figure out how to do this in either a Query or a Report. Thanks for your help.

    SELECT apples.State, apples.AppleColor, Count(apples.AppleColor) AS CountOfAppleColor
    FROM apples
    GROUP BY apples.State, apples.AppleColor;

  2. #2
    JoeM is offline VIP
    Windows XP Access 2007
    Join Date
    Jun 2012
    Posts
    3,904
    You can use the DCOUNT function, i.e.
    Code:
    SELECT apples.State, apples.AppleColor, Count(apples.AppleColor) AS CountOfAppleColor, DCount("*","apples") AS TotalApples
    FROM apples
    GROUP BY apples.State, apples.AppleColor;

  3. #3
    RCinSTP is offline Novice
    Windows XP Access 2003
    Join Date
    Apr 2014
    Posts
    2
    Thank You! that worked perfect

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

Similar Threads

  1. Replies: 1
    Last Post: 01-24-2013, 05:50 PM
  2. COUNT Group Count Records COUNT FUNCTION
    By PMCOFFEY in forum Access
    Replies: 9
    Last Post: 11-09-2012, 09:40 PM
  3. Replies: 3
    Last Post: 08-03-2012, 02:37 AM
  4. Replies: 2
    Last Post: 07-19-2012, 06:23 AM
  5. total Count
    By Alaska1 in forum Access
    Replies: 2
    Last Post: 12-06-2010, 08:09 PM

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