Calculation from a Table

durdle

Registered User.
Local time
Today, 22:21
Joined
May 7, 2002
Messages
130
Hey,

I was wondering if anyone can help me get started on creating calculations from I table. I would assume you would create them in a query, but I am really not sure.
For example:
In tblmain, I have two fields HoursWorked and HourlyWage.
In tblpay I want to take the HoursWorked and HourlyWage and multiple then together for a TotalPay.

Any Ideas would be great thanks

Chris
________
no2 vaporizer reviews
 
Last edited:
Assumption1, both tables have the same KEY somewhere, lets call it EmpNo.

Assumption2, you are appending (adding) these records

Assumption3, Everything in tblmain (no criteria needed)

INSERT INTO tblPay (EmpNo, TotalPay)
Select [tblmain].[EmpNo],[tblmain].[Hoursworked] * [tblmain].[Hourlywage] From tblMain
 
Pat, Pat, Pat, Pat, Pat:
Payroll always stores the amount paid, just in case, at least not having it stored seems to be a real issue with Payroll. Payroll always stores things that could be calculated, I don't even question them anymore (gave up long ago), even vendor software does the same thing. Just seems to be a Payroll thing, or audit point or something.
 
Normally Pat would be right. However, at least for U.S. government personnel shops, you MUST store the pay amount you calculated - but not in the employee table. Usually, you store it in another table that uses employee number and date as a compound key. You do it for purposes of audit accountability under government rules because of some old laws about fiduciary responsibility for audit purposes. Some shops have to apply government-like rules due to the nature of their work or fall under regulations with similar requirements.

Pat and I agree in one regard, though. I would NEVER store the amount in the same table as the employee's personnel record OR in the table where the rate and hours are maintained. That is a SURE place to lose it.
 

Users who are viewing this thread

Back
Top Bottom