ms access 2007 - SQL Average Count of records over n months -
I am trying to do something that sounds simple but I do not understand that it is in SQL How to write. I have a table of records with a date field, I would like to get an average average record per month using the date field, it is not AVG which is grouped by month, but an overall average .
So if there are quotes in my table, and in that table there are 7 different months of data, then I have to get: <
records / N months total months
Now I need to get it in SQL.
You can set the DateDiff
function to min
and < Code> maximum of your date field
:
datediff (interval, date1, date2, [first day] Example: SELECT count (*) / dateDiff ('m', minimum (date), max (date), first [first author] ) ...
How does this work? / P>
count
will give you the number of total rows (# of excerpts in your quotation table) and DateDiff
will be the first and last date
Comments
Post a Comment