I\'m creating a JasperReport using iReport, and as such, I\'m limited* to one SQL query.
I have a table \'statistics\', with a \'name\' (VARCHAR), \
sum(case when -condition- then count else 0 end)
SELECT
SUM(case when $P{oneDayAgo} <= datetime then count else 0 end) as 'today',
SUM(case when $P{oneWeekAgo} <= datetime then count else 0 end) as 'thisweek',
SUM(count) as 'thismonth'
FROM
statistics
WHERE
name = "test"
AND $P{oneMonthAgo} <= datetime
AND datetime <= $P{now}
note that if you need averages, be sure to substitute NULL for 0.