Page MenuHomePhabricator
Paste P45727

unique_devices_by_region_query
ActivePublic

Authored by Mayakp.wiki on Mar 10 2023, 12:53 AM.
Referenced Files
F36904371: unique_devices_by_region_query
Mar 10 2023, 12:53 AM
Subscribers
None
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