Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 Development Tools
 ASP.NET
 Calculating total with columns in temp table

Author  Topic 

Swati Jain
Posting Yak Master

139 Posts

Posted - 2007-10-31 : 06:47:47
select Sum(TotalValue) as GrandTotalValue,Sum(Rvalue) as GrandRValue,Sum(QRvalue)as InvoiceValue
from
@Result
group by TotalValue, Rvalue,QRvalue

Where TotalValue, Rvalue,QRvalue are columns of temprory table for which values are calculated with cursor

But I dont get the Sum as given in above query rather i get separate rows.
How to resolve the issue?

madhivanan
Premature Yak Congratulator

22864 Posts

Posted - 2007-10-31 : 06:55:28
quote:
Originally posted by Swati Jain

select Sum(TotalValue) as GrandTotalValue,Sum(Rvalue) as GrandRValue,Sum(QRvalue)as InvoiceValue
from
@Result
group by TotalValue, Rvalue,QRvalue

Where TotalValue, Rvalue,QRvalue are columns of temprory table for which values are calculated with cursor

But I dont get the Sum as given in above query rather i get separate rows.
How to resolve the issue?


Then dont use Group by clause

Madhivanan

Failing to plan is Planning to fail
Go to Top of Page
   

- Advertisement -