How to Group Educational Activities and Calculate Total Hours in Access
Question details
The user needs to organize staff educational activities by category within an Access database and calculate the total accumulated hours for each staff member.

- Product
- Microsoft Access
- Device & OS
- not provided
- Scenario
- Tracking Continuous Professional Development (CPD) or educational session hours for employees using a relational database.
- Observed behavior
- Requires a structured table design and a grouped query method that correctly joins tables to output the total hours per staff member per category.
Before writing the query, ensure your database tables are properly structured with correct primary and foreign key relationships to prevent duplicate data calculations.
Normalize Database Tables and Execute a Grouped Query
Divide your data into related tables and use an SQL GROUP BY statement to calculate the total hours accurately.
To effectively calculate totals without data duplication, your database should be normalized into distinct tables. Using an INNER JOIN in a grouped SQL query will allow you to combine the session records and calculate the sum of hours based on staff and category IDs.
Create at least four separate tables to manage your data properly: Staff, CPD Categories, Educational Sessions, and Staff Sessions.
In your Staff Sessions table, ensure you include 'StaffID', 'EdSessionID', and 'SessionDate' to track individual attendance for each session.
Navigate to the Create tab, select Query Design, switch to SQL View, and enter the following query: SELECT StaffID, CPDCatID, Sum(CPDHours) AS TotalHours FROM tblStaffSessions INNER JOIN tblEdSession ON tblStaffSessions.EdSessionID = tblEdSession.EdSessionID GROUP BY StaffID, CPDCatID;
Switch back to Query Design View and add the Staff and CPD Category tables to the query space. Drag the relationship lines to link 'StaffID' and 'CPDCatID', then add the Name fields to the query grid so the final output displays actual names instead of just numerical IDs.

Manage and Analyze Your Data Easily with WPS Office
While Microsoft Access handles complex relational databases, WPS Office offers a free, lightweight alternative for your everyday productivity and data tracking needs. If you want to group activities and calculate totals without writing SQL, WPS Spreadsheet provides an intuitive interface with seamless Microsoft Office compatibility.
- 1. Download and Install WPS Office: Get the free WPS Office suite from the official website and install it on your device.
- 2. Import Your Data: Open WPS Spreadsheet and open your exported Access data or CSV files containing the staff session logs.
- 3. Summarize with PivotTables: Go to the Insert tab, click PivotTable, and drag the Staff Name to rows and Session Hours to values to instantly summarize total educational hours.

Frequently Asked Questions
What is database normalization in Microsoft Access?
Database normalization is the process of organizing data into multiple related tables (such as separating Staff details from Session details) to minimize redundancy and prevent data inconsistencies during updates.
Why use an INNER JOIN for calculating total hours?
An INNER JOIN connects records that have matching values in both tables. In this case, it ensures the query only calculates hours for educational sessions that a staff member actually attended by matching the Session IDs.
Can I use a PivotTable instead of an SQL query to calculate hours?
Yes. In Access, you can create a Crosstab Query to achieve a PivotTable-like result. Alternatively, you can export your raw data to a spreadsheet program like WPS Spreadsheet and use the PivotTable feature to group staff members and sum their hours visually.




