SELECT Max(DISTINCT energyConsumtion)-MIN(DISTINCT energyConsumtion) as new_data, COUNT(*), max(timeIn) as timeIn, site_map_pae.site_id
FROM site_map_pae
INNER JOIN electric
ON site_map_pae.site_id = electric.site_id
WHERE off_id = "3"
AND timeIn BETWEEN '2022-01-01 00:00:00' and '2022-12-31 23:59:59'
GROUP BY MONTH(timeIn)