Ignoring the fact that your table isn't properly normalized, the SQL will
look like
SELECT MemberID, Sum(Nz([HoursA], 0) + Nz([HoursB], 0) + Nz([HoursC], 0) +
Nz([HoursD], 0)) AS TotalHours
FROM MyTable
GROUP BY MemberID
That's assuming that you want the sum of all the hours fields.
If you want separate sums for the individual hour fields, it would be
SELECT MemberID, Sum(Nz([HoursA], 0)) AS TotalHoursA,
Sum(Nz([HoursB], 0)) AS TotalHoursB, Sum(Nz([HoursC], 0)) AS TotalHoursC,
Sum(Nz([HoursD], 0)) AS TotalHoursD
FROM MyTable
GROUP BY MemberID
You can create these queries through the query builder by turning your query
into a Totals query (View | Total)
--
Doug Steele, Microsoft Access MVP
(no e-mails, please!)
Walt said:
I have a table containing the following fields: MemberID, HoursA, HoursB,
HoursC and HoursD. I want to create a query that will give me the total
Hours by MemberID. There will be multiple entries in to table for each
Member ID.
How do I create this query?
Thanks, Walt