9 lines
327 B
Text
9 lines
327 B
Text
|
SELECT toYear(Date) as Year, toMonth(Date) as Month, Events
|
||
|
FROM (
|
||
|
SELECT period as Date,
|
||
|
countMerge(events) as Events
|
||
|
FROM monthly_usage_v1
|
||
|
WHERE app_id = '{{app_id}}'
|
||
|
GROUP BY period
|
||
|
ORDER BY period WITH FILL TO toStartOfMonth(now() + INTERVAL 1 MONTH) STEP toIntervalMonth(1)
|
||
|
) ORDER BY Year DESC, Month DESC
|