Generating report with MySQL and Rails - how?
- by Arywista
Here is my data model from my application:
id :integer(4) not null, primary key
spam :boolean(1) not null
duplicate :boolean(1) not null
ignore :boolean(1) not null
brand_id :integer(4) not null
attitude :string not null
posted_at :datetime not null
Attitude could have 3 states: negative, positive, neutral.
I want to generate resultset in table, this way, for each day between start and end date:
date | total | positive | neutral | negative
2009-10-10 | 12 | 4 | 7 | 1
(...)
2009-10-30 | 5 | 2 | 1 | 1
And ignore all records which have:
duplicate = true
ignore = true
spam = true
How it's could be done?