SELECT DATE_FORMAT(month, 'YYYY-MM') AS month, region, SUM(unique_devices) AS unique_devices FROM ( SELECT CONCAT(year,'-',LPAD(month,2,'0'),'-01') AS month, cr.wmf_region AS region, uniques_estimate as unique_devices FROM wmf.unique_devices_per_project_family_monthly ud LEFT JOIN gdi.country_meta_data cr ON ud.country_code=cr.country_code_iso_2 WHERE year >= 2018 AND project_family = 'wikipedia' ) a GROUP BY DATE_FORMAT(month, 'YYYY-MM') , region LIMIT 1000