Advertisement
YuvalGai

Untitled

Sep 8th, 2024
66
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.04 KB | None | 0 0
  1. SELECT
  2. LL_entry_date,
  3. ll_seniority,
  4. country,
  5. platform,
  6. count(distinct user_id) as active_users
  7. from
  8. (
  9. SELECT
  10. *,
  11. datediff(day, LL_entry_date, interval_date) ll_seniority
  12. FROM
  13. (
  14. SELECT
  15. *,
  16. mode(A1) OVER (partition by user_id) LL_entry_date
  17. from
  18. (
  19. SELECT
  20. *,
  21. CASE
  22. WHEN login_arena <= 22
  23. and finish_arena >= 23 then interval_date
  24. else null
  25. end A1
  26. FROM
  27. MATCH_MASTERS.PROD.DAILY_USERS_FROM_PARAMS
  28. where
  29. is_active = 1
  30. )
  31. )
  32. )
  33. where
  34. LL_ENTRY_DATE is not null
  35. and LL_seniority >= 0
  36. group by
  37. 1,
  38. 2,
  39. 3,
  40. 4
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement