Advertisement
kirzecy670

Untitled

Nov 7th, 2024
33
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
MySQL 1.21 KB | None | 0 0
  1. WITH
  2. c_ids AS ( -- UID Родителей, ID Детей, Целевые дети
  3.     SELECT
  4.         uid,
  5.         json_data.2 AS children_id,
  6.         json_data.3 AS children_status
  7.     FROM
  8.         analytics.parent_properties
  9.     ARRAY JOIN
  10.         children AS json_data
  11.     WHERE last_active_datetime >= '2024-09-01'
  12.     and is_full_register
  13. ),
  14. c_prop AS ( -- UID Родителей, UID Детей, ID Детей, Целевые дети Android
  15.     SELECT
  16.         cid.uid AS parent_uid,
  17.         cid.children_id AS child_id,
  18.         cp.uid AS child_uid
  19.     FROM
  20.              c_ids cid
  21.     JOIN
  22.         analytics.child_properties cp ON cid.children_id = cp.id
  23.     WHERE
  24.         cp.platform = 'iOS'
  25. )
  26. SELECT
  27. `action`,
  28. dt,
  29. count(*) AS events,
  30. uniqCombined(uid) AS users
  31. FROM stat.funnelTrack JOIN (SELECT DISTINCT child_uid AS uid FROM c_prop) t1 USING (uid)
  32.     WHERE dt >= '2024-09-01'
  33.         AND dt <= '2024-12-01'
  34. --        AND `action` = 'permission_submit_click'
  35.         AND `action` IN ('mdm_config_screen_show', 'mdm_manage_screen_show', 'mdm_screen_show', 'mdm_config_screen_click', 'mdm_manage_screen_click', 'mdm_config_screen_click_download_again')
  36. GROUP BY 1, 2
  37. ORDER BY 2,1,3 DESC;
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement