How to Calculate Column Summary in sql server.

Total Post:341

Points:2389
C#
 1087  View(s)
Ratings:
Rate this:
I want to  Use Calculate Column Summary in sql server. How to do this please help me.
  1. Post:281

    Points:2003
    Re: How to Calculate Summary and Column Summary in sql server.

    declare @table table(Name varchar(100), Amount decimal(12,2))

    insert into @table

    select 'arjun', 3000 union all

    select 'pawan', 2000 union all

    select 'rahul', 3000 union all

    select 'rahul', 2500 union all

    select 'pawan', 2300 union all

    select 'arjun', 2400

    select Name, SUM(amount) as amount from @table

    group by name

    union all

    select 'Total',SUM(amount) from @table

     

      Modified On Apr-10-2018 11:37:35 PM

Answer