View Full Version : Counting Records ...should be easy...


Dador
07-15-2002, 02:05 PM
Heya all!

I've got a VB program using an Access database. Everything working there just fine... reading and writing with SQL queries.

I've got kind of a "should be simple" problem, but can't figure it out.

Ok, one of my tables has 3 fields. "EmployeeID", "WorkDate", and "WorkArea".

As an example, I have 30 employees. With 30 or so days in the month, I have about 900 records. (One record per employee, per day.)

What I want to do is run a count for each EmployeeID, where I count how many times in "WorkArea" a specific value comes up. For instance, an employee worked in workarea "A" 7 times in a particular month. Do this for each employee.

So, I'd have a quick and dirty report by EmployeeID of how many times they worked in a certain area.

Any ideas on a query/macro/module that could handle that?

Thanks for the help!

--Dador

RV
07-15-2002, 02:43 PM
Use a query:

SELECT EmployeeID, WorkArea, Count(EmployeeID) AS Total
FROM yourtable
GROUP BY WorkArea, EmployeeID
;

RV

Dador
07-15-2002, 07:22 PM
Nice, that got it with a bit of tweaking.

Thank you kindly.

--Dador