Say I have two tables:
KnownHours:
ChargeNum CategoryID Month Hours 111111 1 2/1/09 10 111111 1 3/1/09 30 111111 1 4/1/09 50 222222 1 3/1/09 40 111111 2 4/1/09 50
UnknownHours:
ChargeNum Month Hours 111111 2/1/09 70 111111 3/1/09 40.5 222222 7/1/09 25.5
I need to group these hours, ignoring Month, into a single data table so that my expected result is the following:
ChargeNum CategoryID Hours 111111 1 90 111111 2 50 111111 Unknown 110.5 222222 1 50 222222 Unknown 25.5
I cannot seem to figure this out. Any help greatly appreciated!
EDIT: I need to sum the hours for each ChargeNum/Category combination. I updated the sample data to reflect this.