I would like to know if I can add an average column to this script whereby it averages the total number of inspections by the number of days. At the moment this report is showing 5 days worth of inspections. so I need the averageinspection column to divide the totalinspection by 5. is this possible?
SELECT
EstimName_String AS Inspector,
InspectionProcedureName AS inspection,
COUNT(*) AS TotalInspections
FROM
UnitData_Vehicle
WHERE
DATEDIFF(day, InspectionDateTime, GETDATE()) = 1
GROUP BY
InspectionProcedureName, EstimName_String
I would like to show this:
Inspector Inspection Totalinspections Averageinspections
Joe Bloggs Inspection 20 4
Micky Mouse Inspection 100 20
Jack and Jill Inspection 50 10
1 Answer