SELECT
    DATE_FORMAT(dataTime, '%Y-%m-%d') monthTime,
    COUNT(ht.id) as aCount,
		d.site_id
    FROM
    `ht_analog_data` as ht
		INNER JOIN device as d
		ON ht.deviceName = d.device_code
		INNER JOIN user_site as us
		on d.site_id = us.site_id
    WHERE
    dataTime BETWEEN '1900-5-6 00:00:00' AND '2021-8-6 00:00:00'
		and us.user_id = 1
    GROUP BY monthTime,d.site_id