Help with sum and max query

Please read

Specifically the "be patient" part.