What you probably got is 0
. You should do the sum()
first:
coalesce(sum(hoursworked)/60, 0)
The problem is that SQL Server does integer division, so any value less than 60 (and greater than or equal to 0) will result in 0
. You might really want:
coalesce(sum(hoursworked)/60.0, 0)