Avg on datetime in Access
I am porting some queries from Access to T-SQL and those who wrote the queries used the Avg aggregate function on datetime columns. This is not supported in T-SQL and I can understand why - it doesn't make sense. What is getting averaged?
So I was about to start reverse engineering what Access does when it aggregates datetime using Avg, but thought I would throw the question out here first.
I'd imagine that Access is averaging the numeric representation of the dates. You could do similar in T-SQL with the following...
select AverageDate = cast(avg(cast(MyDateColumn as decimal(20, 10))) as datetime) from MyTable