labtech
Database
Tables
(current)
Columns
Constraints
Relationships
Orphan Tables
Anomalies
Routines
DriveScore
Parameters
Name
Type
Mode
CID
int
IN
Definition
BEGIN Declare score int; Declare result int; Declare Total int; SELECT 1 As Result, 1 as Total, IFNULL(ROUND(100-((SUM(IF(h_DriveStatsDaily.Free<DriveSpaceLevel,1*(DriveSpaceWeight *.01),0)) + SUM(IF(h_DriveStatsDaily.Frag>DriveFragLevel,1*(DriveFragWeight*.01),0)))/ ((Count(*) * (1*(DriveSpaceWeight *.01)))+(Count(*) * (1*(DriveFragWeight*.01))))) *100),100) as DriveScore FROM managementScore,h_DriveStatsDaily Join Drives Using (DriveID) Join Computers Using (ComputerID) Where h_DrivestatsDaily.EventDate=DATE(DATE_ADD(CURDATE(),interval -1 day)) and Computers.ClientID=CID into @result,@total,@score; return @score; END