2014-10-07 62 views

回答

3
select extract(week from date) as week, 
     sum(payment) as payments 
from your_table 
group by week 
+1

'sum'而不羣:

date payment ----- ------- week1 sum(week1) week2 sum(week2) .... ..... 

或每月? – dognose 2014-10-07 16:38:08

+0

當然不是。謝謝 – 2014-10-07 16:39:05

+0

MySQL是否允許你通過別名進行分組? – 2014-10-07 16:41:08