Compute Sum

  • At the end of my select statement I use a compute sum() to get a total. I want to assign the resultset from the compute sum() to a variable. I have tried this which does not work.

    Declare @Total as int

    select first_name, last_name, amount

    from customer

    Group by first_name, last_name, amount

     

    select @Total = compute sum(amount)

     

    This does not work.  any suggestions are appreciated.

    Thanks

     

  • Try this...

    select @Total = sum(amount) from customer

    Steve

  • Thanks but no go.

    Cannot use it in the select statement. I need it in the compute clause.

    Thanks

Viewing 3 posts - 1 through 2 (of 2 total)

You must be logged in to reply to this topic. Login to reply