Hi Team,
Share you suggestions.
declare @Startdate DATETIME,
@enddate DATETIME,
@subsholder NVARCHAR(260) = NULL
SELECT @startdate StartTime,
@enddate EndTime,
SUM(verificationCountTotal) verificationCountTotal,
SUM(verificationCountFailed) verificationCountFailed,
SUM(verificationCountSlow) verificationCountSlow,
SUM(slowTime) slowTime,
AVG(Availability) Availability
FROM
(
SELECT SUM(verificationCountTotal) verificationCountTotal,
SUM(verificationCountFailed) verificationCountFailed,
SUM(verificationCountSlow)verificationCountSlow,
SUM(slowTime) slowTime,
(5 * COUNT(subsholder) - SUM(DownTime)) / CAST(5 * COUNT(subsholder) AS DECIMAL) subsholder
FROM tbl_verfication
WHERE Aggregationdate >= @Startedate
AND Aggregationdate < @enddate
AND ( @subsholder IS NULL OR subsholder = @subsholder)
GROUP BY AggregationDate
) AS Data
Thanks
Thiru
Thiru