SELECT COUNT(${column}) AS total
FROM ${measurement}
WHERE time > '${timeFrom}'
AND time <= '${timeTo}'
${
locationId
? `AND ( locationLevel2 = '${locationId}'
OR locationLevel3 = '${locationId}'
OR locationLevel4 = '${locationId}'
OR locationLevel5 = '${locationId}'
OR officeLocation = '${locationId}')`
: ``
}
GROUP BY time(30d), timeLabel, eventLocationType ORDER BY time DESC
I want to convert this to flux query which will support in influxDB version 1.8. instead of time(30d), want to group by each month.