select DATE_FORMAT(o, '%Y-%m-%d'), sum(case when title = 'Mansfield Park' then 1 else 0 end)as 'Mansfield Park',sum(case when title = 'Sense and Sensibility' then 1 else 0 end)as 'Sense and Sensibility', sum(case when title = 'Pride and Prejudice' then 1 else 0 end) as 'Pride and Prejudice', sum(case when title = 'Emma' then 1 else 0 end) as emma, sum(case when title = 'Becoming Jane' then 1 else 0 end) as Jane from activity, title where title.bib=activity.bib and o> '2007-01-01' and o < '2012-01-01' group by year(o), month(o) order by year(o), month(o);
2007-01-02,20,38,55,45,0
2007-02-02,22,47,61,54,0
2007-03-01,25,56,66,70,0
2007-04-01,24,59,72,65,0
2007-05-01,27,62,60,68,0
2007-06-02,25,63,64,75,0
2007-07-01,33,63,73,57,0
2007-08-01,31,67,77,61,0
2007-09-01,30,55,70,59,0
2007-10-01,30,53,56,59,0
2007-11-01,23,56,69,59,0
2007-12-01,27,55,62,53,0
2008-01-02,28,68,80,56,0
2008-02-01,26,61,72,61,53
2008-03-01,65,56,81,56,197
2008-04-01,97,66,92,59,309
2008-05-01,122,59,66,50,298
2008-06-01,113,65,107,66,280
2008-07-01,130,67,110,79,331
2008-08-01,137,63,108,87,351
2008-09-02,125,60,97,79,334
2008-10-01,109,56,92,43,319
2008-11-01,108,46,70,66,300
2008-12-01,115,52,89,56,351
2009-01-02,135,58,105,71,372
2009-02-01,115,61,93,64,302
2009-03-01,113,59,97,60,346
2009-04-01,108,52,89,60,308
2009-05-01,108,57,82,61,288
2009-06-01,124,61,113,59,323
2009-07-01,110,60,91,75,307
2009-08-01,110,52,89,64,294
2009-09-08,88,29,53,44,227
2009-10-01,118,50,87,68,285
2009-11-01,105,39,65,72,282
2009-12-01,101,43,70,52,295
2010-01-02,102,47,110,41,299
2010-02-01,83,49,92,78,272
2010-03-01,119,37,106,98,304
2010-04-01,111,32,94,100,253
2010-05-01,100,32,84,97,252
2010-06-01,108,32,115,111,264
2010-07-01,106,40,100,97,241
2010-08-01,101,38,89,101,190
2010-09-07,80,20,89,78,148
2010-10-01,98,26,84,101,181
2010-11-01,104,17,92,85,185
2010-12-01,107,23,90,108,192
2011-01-02,121,22,89,101,179
2011-02-01,79,29,77,99,166
2011-03-01,95,44,87,102,195
2011-04-01,89,53,73,98,180
2011-05-01,86,58,85,101,140
2011-06-01,97,68,86,91,157
2011-07-01,93,49,81,90,139
2011-08-01,85,57,76,96,135
2011-09-01,70,42,68,79,120
2011-10-01,90,46,85,78,130
2011-11-01,78,50,79,78,127
2011-12-01,82,43,90,79,129
