Update Query

M

Melinda

I have an overtime database which tracts overtime. At the end of the year
we equalize the overtime. We have to subtract the lowest employee from the
highest employee by Class No. When I create an update query how do I sum
the hours worked and subtract off the hours I am rolling that employee back.
I tried sum[hoursworked]-458.0 and i still get 10 records for that employee
instead of that paticular employees hours being summed. The query runs as
if it going to subtract 458 off each and every line. I would appreciate any
help.
 
D

Dale Fye

I'm not sure why your subject says "Update", this seems more like a Select
query. I think your query should look something like:

SELECT EmployeeID, SUM([HoursWorked]) - 458
FROM yourTable
GROUP BY EmployeeID

This will sum their hours worked and subtract 458, so that you only have a
single record for each employee.

HTH
Dale
 
M

Melinda

I hope you can bear with me, I am fairly new at all of this. After that
being said, I have several overtime entries. It seems as if when I do that
expression it subtracts 457.8 from each and every entry and I end up with a
negative balance.
Here is an example:

Class No Name Hours Worked Refused Hours
YTD Hours
33774 Williams, James 457.8 0
457.8
33774 Imm, Brian 569.3 0
569.3
33774 Laubis, Tim 879.8 0
879.8

and so forth: I need to feed a -457.8 back into the tblhours so it
subtracts it and give each employee a new overtime balance to begin with. I
know I am probably not explaining this the best. So I guess I just thought
I could update it back into the table. Thanks

Dale Fye said:
I'm not sure why your subject says "Update", this seems more like a Select
query. I think your query should look something like:

SELECT EmployeeID, SUM([HoursWorked]) - 458
FROM yourTable
GROUP BY EmployeeID

This will sum their hours worked and subtract 458, so that you only have a
single record for each employee.

HTH
Dale

--
Don''t forget to rate the post if it was helpful!

email address is invalid
Please reply to newsgroup only.



Melinda said:
I have an overtime database which tracts overtime. At the end of the year
we equalize the overtime. We have to subtract the lowest employee from the
highest employee by Class No. When I create an update query how do I sum
the hours worked and subtract off the hours I am rolling that employee back.
I tried sum[hoursworked]-458.0 and i still get 10 records for that employee
instead of that paticular employees hours being summed. The query runs as
if it going to subtract 458 off each and every line. I would appreciate any
help.
 

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

Similar Threads

Queries? 9
Update Queries 4
Negative Numbers 2
Update Query 11
How to count records w/o counting duplicates by week, month, or ye 4
update crosstab 1
Calculating Overtime Problem 2
Time Tracking & Reports 1

Top