我有一个mysql表Trip,其中包含字段:
id int
Weekdate DATE (date field shows Monday's date)
Trip VARCHAR
Driver VARCHAR
TripPrice DOUBLE
...
我使用select选择一个月来从表中选择当月的所有行,并且需要输出按月分割的数据。它应该看起来像:
July:
-----------------------
WEEK1: 2013-05-01 ...
WEEK1: 2013-05-01 ...
WEEK1: 2013-05-01 ...
WEEK1_TOTAL: sum(tripprice)
-----------------------
WEEK2: 2013-05-08 ...
WEEK2: 2013-05-08 ...
WEEK2: 2013-05-08 ...
WEEK2_TOTAL: sum(tripprice)
-----------------------
有什么想法吗?