I'm trying to use a slightly more interesting GROUP BY reason than what the DataMapper out of the box seems to support.
The query I want to create looks something like this:
SELECT SUM(downloads), SUM(uploads) FROM daily_stats GROUP BY YEARWEEK(date)
I would just like to say DataMapper something like that:
DailyStat.aggregate(:downloads.sum, :uploads.sum, :fields => [ :date.yearweek ])
Where to begin? Is it easily achievable?
Mikeq source
share