I need to calculate the total number of personal time off hours (PTOs) an employee has taken since his last employment anniversary date. For example, the calculation should take into account the Hire Date of the employee and when was the last anniversary date for this employee and then return the sum of the all the hours taken as of the day of the query by the employee.

I have a table that store the EmpID, Name, HireDate and a second table the stores NumberOfPTOHours, DateTaken, EmpID, etc.

Any help would be greatly appreciated.

Thanks!