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.

Answers


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

Need Your Help

Word frequency algorithm for natural language processing

algorithm nlp word-frequency

Without getting a degree in information retrieval, I'd like to know if there exists any algorithms for counting the frequency that words occur in a given body of text. The goal is to get a "general

How to check if first character of a string is a letter c#

c# string matrix console-application

i need some help. I have to write a programm where you can do some calculation with matrices.