JasonBowen
6 years agoQrew Trainee
Totaling a field with matching criteria from an UNRELATED table
Background:
An [EMPLOYEE] can have many [OVERTIME] records (which are added by a supervisor after the overtime has been accrued).
An [EMPLOYEE] can have many [OT PROJECTION] records (which are projections of potential overtime added by the supervisor the week prior).
It is possible to have multiple overtime records assigned to a particular employee and date.
It is possible to have multiple overtime projection records assigned to a particular employee and date.
Typically, our client wants us to provide a projection of all employee potential overtime for the upcoming week ahead of time. Therefore, the supervisor will create many overtime projection records.
The actual overtime records can't be created until the overtime is actually accrued, because only then would the supervisor know what to enter.
I need a way for [OVERTIME] records to display the correllating SUM of [OT PROJECTION] hours for that particular employee and date (so we can easily determine if an employee's actual overtime exceeded the amount of overtime that was projected earlier).
I can't seem to find a way to do this easily. Relationships between the [OVERTIME] and [OT PROJECTION] tables doesn't seem to work because there is no set order in which the records will be created.
It's possible to have overtime records entered prior to any related overtime projection records created as well.
TARGET
A supervisor can pull up the report of all overtime for a particular week.
He'll see that employee "x" accrued overtime on various dates, and can also see the total amount of projected overtime on that date for that employee as well.
An [EMPLOYEE] can have many [OVERTIME] records (which are added by a supervisor after the overtime has been accrued).
An [EMPLOYEE] can have many [OT PROJECTION] records (which are projections of potential overtime added by the supervisor the week prior).
It is possible to have multiple overtime records assigned to a particular employee and date.
It is possible to have multiple overtime projection records assigned to a particular employee and date.
Typically, our client wants us to provide a projection of all employee potential overtime for the upcoming week ahead of time. Therefore, the supervisor will create many overtime projection records.
The actual overtime records can't be created until the overtime is actually accrued, because only then would the supervisor know what to enter.
I need a way for [OVERTIME] records to display the correllating SUM of [OT PROJECTION] hours for that particular employee and date (so we can easily determine if an employee's actual overtime exceeded the amount of overtime that was projected earlier).
I can't seem to find a way to do this easily. Relationships between the [OVERTIME] and [OT PROJECTION] tables doesn't seem to work because there is no set order in which the records will be created.
It's possible to have overtime records entered prior to any related overtime projection records created as well.
TARGET
A supervisor can pull up the report of all overtime for a particular week.
He'll see that employee "x" accrued overtime on various dates, and can also see the total amount of projected overtime on that date for that employee as well.