• As Anthony.Green mentioned, it sounds like you need to be grouping your data in the first table. Without seeing a sample dataset it's difficult to provide info on what to group by -- I'd be guessing if I simply said group by Account...

    --Pete