选择给定月份的所有行,并输出按月份分割的行

时间:2013-07-11 21:50:47

标签: php mysql

我有一个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)

-----------------------

有什么想法吗?

0 个答案:

没有答案