Results 1 to 5 of 5
  1. #1
    fluffyvampirekitten is offline Competent Performer
    Windows 7 64bit Access 2013
    Join Date
    Jun 2015
    Posts
    108

    Help with SQL query count function

    I want to do a "SUM" of "NO_OF_GROUP" by "INSTITUTION"
    How do i write this in sql query statement ?

    The image below is an example of my table:

    Click image for larger version. 

Name:	Capture.JPG 
Views:	15 
Size:	76.6 KB 
ID:	21679



    Result:

    Click image for larger version. 

Name:	Capture.JPG 
Views:	15 
Size:	29.0 KB 
ID:	21680

    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,726
    Please show the SQL for your current query attempts.

  3. #3
    NoellaG's Avatar
    NoellaG is offline VIP
    Windows 7 Access 2010 (version 14.0)
    Join Date
    Jun 2010
    Location
    Belgium
    Posts
    1,044
    select category, fieldmatched, institution, sum(NO_OF_GROUP) as SumGroups
    from [MyTableName]
    group by category, fieldmatched, institution

  4. #4
    fluffyvampirekitten is offline Competent Performer
    Windows 7 64bit Access 2013
    Join Date
    Jun 2015
    Posts
    108
    Quote Originally Posted by orange View Post
    Please show the SQL for your current query attempts.
    Code:
    SELECT GROUPING.CATEGORY, GROUPING.FIELDMATCHED, GROUPING.INSTITUTION, Count(*) AS NO_OF_GROUP, SummaryDate.Record_Period
    FROM (SELECT DISTINCT CATEGORY, GROUP_NO, INSTITUTION, FIELDMATCHED FROM CrossSystemData WHERE INSTITUTION NOT LIKE "*UNKNOWN*")  AS GROUPING, (SELECT Start_Range, End_Range FROM Setting WHERE Type = 'SUMMARY_RANGE')  AS Range, (SELECT Record_Period FROM Summary)  AS SummaryDate
    WHERE (((Summary.Record_Period) Between [Range].[Start_Range] And [Range].[End_Range])) AND (((GROUPING.CATEGORY)="POTENTIAL DUP") AND ((GROUPING.FIELDMATCHED)="HIGH"))
    GROUP BY GROUPING.CATEGORY, GROUPING.FIELDMATCHED, GROUPING.INSTITUTION, SummaryDate.Record_Period
    ORDER BY Count(*) DESC;

  5. #5
    fluffyvampirekitten is offline Competent Performer
    Windows 7 64bit Access 2013
    Join Date
    Jun 2015
    Posts
    108
    Thanks!

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

Similar Threads

  1. Using the 'Count' function in a totals query
    By sjs94704 in forum Access
    Replies: 1
    Last Post: 10-04-2014, 10:37 AM
  2. COUNT Group Count Records COUNT FUNCTION
    By PMCOFFEY in forum Access
    Replies: 9
    Last Post: 11-09-2012, 09:40 PM
  3. Count Function in query
    By tjstromquist in forum Queries
    Replies: 1
    Last Post: 04-03-2012, 10:40 AM
  4. Count function on query
    By yousillygoose in forum Queries
    Replies: 1
    Last Post: 02-15-2010, 09:58 PM
  5. Query using count function
    By wasim_sono in forum Queries
    Replies: 0
    Last Post: 11-28-2007, 03:16 AM

Tags for this Thread

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