I believe the SUMPRODUCT formula is the best for this application.
Modify the following formula to suit:
=SUMPRODUCT(--(A2:A5=F2),--(B2:B5=G2),C2:C5)
As a reference, the "A2:A5" represents the date column in the main database that you are querying (worksheet A). The "F2" represents the date cell in Worksheet B. "B2:B5" represents the ID field in Worksheet A, and G2 represents the employee ID in Worksheet B. Finally, "C2:C5" represents the employee hours column in Worksheet A. Let me know if you were able to adapt this.
Bookmarks