modify query for eveluating total work count to be inserted into tally