Please Help Build an expression

L

lmyrfield

I have an employee database, I have created a query that has the following
fields Employee ID, hourly wage, month, hours worked, and than an expression
that multiplies the wage by the hours worked to give the monthly amount
paid. I want to add all the months up to get the yearly amount paid out, to
each employee individually, and I want all the employees to show in the same
query.
Basically I want to add the first 12 records (months) together (for the
first employee) than the next 12 records together (the next employee) and so
on and have the resulting query just show one record for each employees
yearly pay. I think I may have to build another expression but I don't know
how. Please Any help would be wonderful I need it ASAP Thanks
 
K

KARL DEWEY

Try this substituting your table name for lmyrfield --
SELECT lmyrfield.EmployeeID, Sum([hours worked]*[hourly wage]) AS Paid
FROM lmyrfield
GROUP BY lmyrfield.EmployeeID;

Better than having a month field would be to have a DateTime field for
WeekEnding and pull records for the last 12 months --
SELECT lmyrfield.EmployeeID, Sum([hours worked]*[hourly wage]) AS Paid
FROM lmyrfield
WHERE (((lmyrfield.WeekEnding) Between DateAdd("m",-11,Date()) And Date()))
GROUP BY lmyrfield.EmployeeID;
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top