tcmmaxt
asked on
How i return the sum of a range numeric column count values isql 2005 server
Expert: I need to return the Sum of cnt (totals of all counts) in the SP procedure below with along with the other data back to my dot net app. Could someone kindly show me what changes I have to make to my SP to return the Sum ? thanks for your help here.
ALTER procedure [dbo].[GetRatingCount]
@startdate datetime,
@enddate datetime
as
ALTER procedure [dbo].[GetRatingCount]
@startdate datetime,
@enddate datetime
as
set nocount on
select rating_type, count(*) cnt
from TableA
where Date1 >= @startdate
and Date1 < @enddate
group by rating_type
ALTER procedure [dbo].[GetRatingCount]
@startdate datetime,
@enddate datetime
as
ALTER procedure [dbo].[GetRatingCount]
@startdate datetime,
@enddate datetime
as
set nocount on
select rating_type, count(*) cnt
from TableA
where Date1 >= @startdate
and Date1 < @enddate
group by rating_type
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
nice
select count(*) as cnt
from TableA
where Date1 >= @startdate
and Date1 < @enddate
Or you can do a union and add one more row to your table
select rating_type, count(*) cnt
from TableA
where Date1 >= @startdate
and Date1 < @enddate
group by rating_type
Union
select count(*) as cnt
from TableA
where Date1 >= @startdate
and Date1 < @enddate