March 2012:
9 27 28 29 1 2 3 4
10 5 6 7 8 9 10 11
11 12 13 14 15 16 17 18
12 19 20 21 22 23 24 25
13 26 27 28 29 30 31
First column this is number week of year – in php date(“W”);
I have in database MySQL:
id | count | date
1 | 2 | 2012-02-28 11:11:11 // 9 week
2 | 4 | 2012-02-29 11:11:11 // 9 week
3 | 5 | 2012-03-01 11:11:11 // 9 week
4 | 2 | 2012-03-03 11:11:11 // 9 week
5 | 5 | 2012-03-05 11:11:11 // 10 week
6 | 3 | 2012-03-07 11:11:11 // 10 week
7 | 6 | 2012-03-08 11:11:11 // 10 week
8 | 2 | 2012-03-12 11:11:11 // 11 week
9 | 6 | 2012-03-13 11:11:11 // 11 week
10 | 5 | 2012-03-16 11:11:11 // 11 week
11 | 1 | 2012-03-16 11:11:11 // 11 week
12 | 9 | 2012-03-16 11:11:11 // 11 week
How can i SUM with Symfony 1.4 and Doctrine 1.2 for all week?
In this example should show me:
week | count
9 | 13
10 | 14
11 | 23
How should look query with Doctrine?
According to that http://sqlfiddle.com/#!2/9701b/6, I will perfom this query:
I used
as date_formattedin the select clause because Doctrine doesn’t understand thedate_formatin thegroupBymethod.