-561 Sums and averages cannot be computed on datetime values.
This statement applies an aggregate function such as SUM to a column
that has the type DATETIME. The function is not defined on this data
type since arithmetic is not. Review the use of aggregate functions.
You will have to revise the query.