K kitty77 Registered User. Local time Today, 16:26 Joined May 27, 2019 Messages 719 Nov 8, 2019 #1 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...
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, 21:26 Joined Jan 14, 2017 Messages 19,139 Nov 8, 2019 #2 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
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
P plog Banishment Pending Local time Today, 15:26 Joined May 11, 2011 Messages 12,026 Nov 8, 2019 #3 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
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