Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Distinct Count in Result Set

Status
Not open for further replies.

R7Dave

Programmer
Oct 31, 2007
181
US
Hello

If I have a statement like the one below, how can I return a grand total of all of the records?

I want the query results to contain on record that will show the sum(Reserve + PaidLoss + PaidLegal + PaidNonLgl)
but for all rows

Thanks
Dave

select
sum(Reserve + PaidLoss + PaidLegal + PaidNonLgl)
from
claimsuf cs
join lossdesclookup ldl
on cs.causecode=ldl.cause
join lossDescription ld
on cs.claimnum=ld.claimnumber
and ld.descid=ldl.recid
group by
cs.claimnum, cs.suffix
, CLOB.Description
, ldl.description
, ld.LossDescription
, cs.Reserve
, cs.PaidLoss
, cs.PaidLegal
, cs.PaidNonLgl

 
This is a sql question not an ASP.NET question.
Do you want to just sum those columns for everyrow so that you just get a one row result that holds the total?
If that is the case, then remove the group by clause. You don't need it if you expect just a grand total for the whole table.
 
Wrong group - sorry about that - but thank you for taking the time to answer anyway - I appreciate it
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top