Zalvena-Service/etc/clickhouse/queries/live_geo__v1.liquid

14 lines
391 B
Text
Raw Permalink Normal View History

2025-02-19 16:44:17 -05:00
SELECT uniq(user_id) as Users,
country_code as CountryCode,
region_name as RegionName
FROM (
SELECT session_id,
min(min_timestamp) AS timestamp,
any(user_id) AS user_id,
any(country_code) AS country_code,
any(region_name) AS region_name
FROM sessions_live_v1
WHERE app_id = '{{app_id}}'
GROUP BY session_id
HAVING timestamp >= now() - INTERVAL 1 HOUR
) GROUP BY country_code, region_name