I have data in the following format:
1/1/2017 55
1/3/2017 23
1/3/2017 87
1/3/2017 45
1/4/2017 77
1/4/2017 90
1/4/2017 34
What is the fasted and most efficient way to query the database and output the average value for each date?
Your question is missing a lot of information and shows little or no effort in solving the problem.
Regardless, you can use a SQL query like this to achieve the results you want:
SELECT date_col, AVG(number_col) as average FROM table_name GROUP BY date_col
尝试这个
SELECT avg(value_field) FROM `table_name` group by date _field
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.