This query retrieves the top 1000 most common values and their frequency for a property in the last 30 days.
Property Values Over Time for a Person
SELECT person, person_id, property_value('campaign name'), from_unixtime(timestamp_ms/1000) as property_datetimeFROM recordsWHERE person IN (select person from records where person_id ='IkpsKWXWQv6atHseDye7tHy6Tlc=')AND has_property('campaign name')AND date_sub(from_unixtime(timestamp_ms/1000), 0) >= date_sub(current_timestamp(), 180)ANDyearin (year(date_sub(current_timestamp(), 0)), year(date_sub(current_timestamp(), 180)))ANDmonthin (month(date_sub(current_timestamp(), 0)), month(date_sub(current_timestamp(), 180)))ORDER BY3DESCLIMIT100
This query shows property values and timestamps for campaign name for a single person over the last 180 days.
Device Type Analysis
SELECT concat_ws(', ', person_devices) as person_device_list,COUNT( DISTINCT person ) as person_cntFROM(SELECT DISTINCT person, collect_set(property_value('km device type')) as person_devicesFROM recordsWHERE has_property('km device type')AND date_sub(from_unixtime(timestamp_ms/1000), 0) >= date_sub(current_timestamp(), 30)ANDyearin (year(date_sub(current_timestamp(), 0)), year(date_sub(current_timestamp(), 30)))ANDmonthin (month(date_sub(current_timestamp(), 0)), month(date_sub(current_timestamp(), 30)))GROUP BY1) pdGROUP BY1ORDER BY2DESC
This query returns device type values for people tracked in the last 30 days.
🚧Note:
Due to the way our data is stored we cannot do SELECT *