1
BEGIN
2
Declare score int;
3
Declare result int;
4
Declare Total int;
5
SELECT 1 as Total,
6
1 as Result,
7
IF(IFNULL(ROUND(((SUM( NoneMissing ) + ( SUM( Missing1to2 ) * ( PatchMissing12Weight * .01 ) ) + ( SUM( Missing3to5 ) * ( PatchMissing35Weight * .01 ) )
8
+ ( SUM( Missing5 ) * ( PatchMissing6Weight * .01 ) ))/Count(*))*100),0)>0,
9
IFNULL(ROUND(((SUM( NoneMissing ) + ( SUM( Missing1to2 ) * ( PatchMissing12Weight * .01 ) ) + ( SUM( Missing3to5 ) * ( PatchMissing35Weight * .01 ) )
10
+ ( SUM( Missing5 ) * ( PatchMissing6Weight * .01 ) ))/Count(*))*100),0),0) as PatchScore
11
from v_Patch,managementscore where ClientID=CID into @total,@result,@score;
12
return @score;
13
END