You can use a SQL statement to quickly summarize data in a
table. For example, suppose you need to create a report showing the total
number of hours each employee worked over a quarter. Follow these steps:
- Open
the database containing the HoursWorked table
for the quarter, then click Queries in the objects list in the database
window. - Click
New, Design View and OK. - Click
Close. - Go to
Query | SQL Specific | Data Definition. - Enter
the following statement:
SELECT DISTINCTROW [HoursWorked].[Employee ID],
SUM([Hours Worked].Hours) AS [Sum of Hours]
FROM [Hours Worked]
GROUP BY [Hours Worked].[Employee ID]; - Click
Run.
The results will show total hours worked grouped by Employee
ID. This query can be saved and used to create the quarterly report.
Miss a tip?
Check out the Microsoft Access archive, and catch up on our most recent Access tips.
Help users increase productivity by automatically signing up for TechRepublic’s free Microsoft Office Suite newsletter, featuring Word, Excel, and Access tips, delivered each Wednesday.