0

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

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

有任何想法吗?

4

0 回答 0