如何计算具有随机数据的不同月份的平均值

时间:2014-09-16 10:59:38

标签: php mysql

Date                           Volume 
Friday, July 01, 2011          31,400 
Monday, July 04, 2011          50,600 
Tuesday, July 05, 2011         60,600 
Wednesday, July 06, 2011       50,200 
Thursday, July 07, 2011        56,000 
Friday, July 08, 2011          23,800 
Monday, July 11, 2011          25,600 
Tuesday, July 12, 2011         24,800 
Wednesday, July 13, 2011       36,200 
Thursday, July 14, 2011        22,800 
Friday, July 15, 2011          62,800 
Monday, July 18, 2011          47,000 
Tuesday, July 19, 2011         75,800 
Wednesday, July 20, 2011       66,600 
Thursday, July 21, 2011        54,000 
Friday, July 22, 2011          57,800 
Monday, July 25, 2011          24,000 
Tuesday, July 26, 2011         24,800 
Wednesday, July 27, 2011       50,400 
Thursday, July 28, 2011        52,800 
Friday, July 29, 2011          34,000 
Monday, August 01, 2011        28,600 
Tuesday, August 02, 2011       12,400 
Wednesday, August 03, 2011     39,200 
Thursday, August 04, 2011      42,200 
Friday, August 05, 2011        92,800 
Monday, August 08, 2011        88,800 
Tuesday, August 09, 2011       59,600 
Wednesday, August 10, 2011     58,800 
Thursday, August 11, 2011      50,000 
Friday, August 12, 2011        39,800 
Monday, August 15, 2011        15,800 
Tuesday, August 16, 2011       22,800 
Wednesday, August 17, 2011     37,000 
Thursday, August 18, 2011      35,400 
Friday, August 19, 2011        33,600 
Monday, August 22, 2011        27,600 
Tuesday, August 23, 2011       17,714 
Wednesday, August 24, 2011     31,497 
Thursday, August 25, 2011      38,800 
Friday, August 26, 2011        12,310
Monday, August 29, 2011        33,200 
Tuesday, August 30, 2011       47,600 

我需要知道每个月的平均体积

1 个答案:

答案 0 :(得分:0)

尝试此查询:

SELECT 
  MONTH(Date) as Month, 
  AVG(Volume) as Volume
FROM
  table
GROUP BY
  MONTH(Date)