To aggregate time periods, use :hour, :date, :year, etc.
Example
select [created_at:date] from payments; select [created_at:week] from payments; select [created_at:month] from payments; select [created_at:quarter] from payments;
The following aggregations are supported:
:sec
:min
:hour
:day
:date
:week
:month
:quarter
:year
A query like this could show you revenue over the quarter:
select [created_at:quarter] as period, sum(payments.total) as total_revenue from payments group by 1
Happy queries!