Daily / Monthly Report

Report

I need to create a daily report + monthly report with this records..

Calls
Texts
Emails

Is there any possible way to create a single query that will
generate this daily report + monthly report.?

Ex.

          Day1 Day2 Day3 etc.. Total
Calls 20 23 23 ... 66

Texts 120 125 130 ... 375

Emails 50 60 55 ... 165

Total 190 208 208 ... 606

If not, please tell how to do it the simplest way, and how to this on
rails.?

Thanks in advance...

This is your basic “cross-tab” report.

However, since you did not provide a layout of your table(s), it’s not really possible to help you with the query.

So, perhaps this will help:

http://www.simple-talk.com/sql/t-sql-programming/creating-cross-tab-queries-and-pivot-tables-in-sql/

or you can google “crosstab reports in rails”

HTH,
Dan