SELECT
    COUNT(*)
FROM
    (
        SELECT
            :periodBASE
    FROM
			cloud_date_table PC
WHERE
    PC.cloud_date BETWEEN DATETIME(:fromParam) AND DATETIME(:toParam)
GROUP BY
    period
    )