Count and Average (1 Viewer)

kitty77

Registered User.
Local time
Today, 04:55
Joined
May 27, 2019
Messages
693
How can I count the records for each day (by date) and then get an average for each day? What is the best way?

Thanks...
 

isladogs

MVP / VIP
Local time
Today, 08:55
Joined
Jan 14, 2017
Messages
18,164
Use aggregate (totals) query or queries.
First group records by date. Next add the date field again or ID field and change group by to Count.
Depending on what you want to average, do something similar but set to average
 

plog

Banishment Pending
Local time
Today, 03:55
Joined
May 11, 2011
Messages
11,597
Yes this is a simple aggregate query, using common aggregate functions:

https://www.w3schools.com/sql/sql_count_avg_sum.asp


Code:
SELECT DateField, COUNT(DateField) AS RecordCount, AVG(FieldToAverage) AS AveragedField
FROM YourTableNameHere
GROUP BY DateField
 

Users who are viewing this thread

Top Bottom