Using two Sum() functions in a multiple join query