HOW TO CALCULATE COLUMN SUMMARY IN SQL SERVER.

Ankit Singh

Total Post:341

Points:2389
Posted by  Ankit Singh
C#
 746  View(s)
Ratings:
Rate this:
I want to  Use Calculate Column Summary in sql server. How to do this please help me.
  1. aditya kumar Patel

    Post:254

    Points:1810
    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

     

Answer

NEWSLETTER

Enter your email address here always to be updated. We promise not to spam!