Hey there,
I'm very bad with SQL statements and am struggling for a while now. Maybe you guys can help me out?
I have a table with tracked work times "RecordedTimeInSeconds" and a flag, if they are productive or unproductive "IsCalculable"
I would like to calculate the percentage of productive and unproductive time grouped by Firstname.
This is what I tried but seems not to work:
SELECT [Lastname],((SUM([RecordedTimeInSeconds])/3600 )* 100) /
(
SELECT (SUM([RecordedTimeInSeconds])/3600)
FROM [cvw_EmployeeHelpdeskTimerStatistic]
WHERE YEAR([Date]) = YEAR(getdate())
) as Score
FROM [cvw_EmployeeHelpdeskTimerStatistic]
WHERE YEAR([Date]) = YEAR(getdate())
AND [IsCalculable] = '1'
GROUP BY [Lastname]