Sum column base on where clause and then subtract it from a different table's column based on a where cluase
Posted on 2014-04-17
I have a table name TimeUsed. It contains columns:
StaffMemberID, RequestType, RequestHours.
I need to sum Request hours based upon RequestType and StaffMemberID.
The possible values for RequestType are Vacation, Sick, and Personal
I then need to subtract that figure from the TimeEarned table's VacationEarned, PersonalEarned and SickEarned columns.
Your help will be greatly appreciated.