Home   Fees/Services   Access Templates   Tutorials   Tutorial Downloads   Articles   Search   Contact  Privacy  Links
Access SQL Group By Statement Tutorial
Group By Query Example
Home > Tutorials > Query Tutorials > Group By Statement

Query Tutorials Index:
Too Complex Query
Aggregate Query
Not In Operator
Choose Function
Crosstab Query
Date Time Query
SQL Delete Query
External Table Query
Report Filter Query
Group By Query
Having Query Clause
Histogram Query
Access Append Query
Master Detail Update
Order By Query
SQL Parameter Query
Predicate Query
Self Join Query
Scalar SubQuery
Master Detail Query
Select Query
Access SQL Select Top
SQL Union Query
SQL Update Query
Custom Query Function


MultiSelect Parameter Forms Access Tutorial

Access Group By Clause

Group By SQL clause is a query command used to combine data based on the value(s) in the field(s) of a table(s).  The Group By clause is most often used in combination with one or more aggregate functions.

You did not know that nearly 100 cable and satellite tv installers use our software to manage their device inventory. They never lose track of an expensive device.

Did you know that most template databases often do not do exactly what you need done? We can create a custom template that fits your needs exactly.

The basic syntax of the Group By statement is:

Group By TableName.Field1, TableName.Field2

The Access group by clause comes after the where clause of a query and before the optional having clause in the query:

Select TableName.FieldName1, Count(TableName.Field2),Avg(TableName.Field3) From TableName Where your criteria Group By TableName.FieldName1 Having some criteria.

Note: The ending semicolon is a required component of all SQL statements.

Now see the Access group by clause with real column and table names:

Select M_Employees.Emp_Name, Sum(iif(Daily_Absence=true,1,0)), Avg(Daily_Hours) From M_Employees Where M_Employees.Work_Date>=#01/01/05# and M_Employees.Work_Date<=#03/31/05# Group By M_Employees.Emp_Name Having Sum(iif(Daily_Absence=true,1,0))>3;

The above query will select distinct employee names whose daily absences total more than 3 during the 1st quarter of 2005 and will display the average of the hours worked per day during the same time period grouped by emp_name.

More Group By Query Examples and Discussion:

Aggregate Functions
ggregates are most often used in combination with an SQL Group By clause. ... Note there is no Group By which is normally associated with an aggregate function...

Having Clause SQL
QL Having clause: The having clause is used in conjunction with the SQL group by clause and aggregate functions to categorize and summarize data into groups...

A Blue Claw Software Design Template:

Corporate Document Control Solution

A Blue Claw Database Design Article:

Why Choose Microsoft Access

Blue Claw Database Design Downloadable Tutorial:
Bar Chart / Bar Graph Download  

Microsoft Office:
MS Access 2000 Through Access 2016 & Office 365

Contact Information
Copyright 2000-2017 Blue Claw Database Design
Development in Microsoft Access, Microsoft SQL/Server and Azure

See our SQL/Server Development and Access Migration Tutorials