• It isn't really clear what you are trying to do. Is this what you want:

    SELECT party_code, sum(inst_amt) as total_insts, sum(paid_amt) as total_paid

    FROM @table WHERE paid_date < '2012-11-23T00:00:00'

    GROUP BY party_code

    That would make commercial sense of a sort, but what you asked for didn't restrict the inst amounts to those before 2012-11-23, only the paid amounts, so the person who replied previously suggested code that didn't make that restriction. Presumably that was because he wanted to suggest code that did what you actually asked for rather than code that did something sensible - - thinking that people actually mean what they say is the cause of a lot of software problems.

    But even the above may not be what you wanted, because you may want to restrict the inst amounts based on inst_date rather than paid_date. That would be different code yet again.

    Of course as you haven't named the table you will have to change @table to be whatever the table is called for the code to make sense.

    Tom