Advertisement
kirzecy670

Untitled

Jul 3rd, 2025
223
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
MySQL 0.65 KB | None | 0 0
  1. SELECT
  2.     circle_id,
  3.     user_id,
  4.     user_role,
  5.     created_ts                                                                     AS join_ts,
  6.     argMin(user_id, created_ts) OVER (PARTITION BY circle_id)                      AS creator_id,
  7.     min(created_ts) OVER (PARTITION BY circle_id)                                  AS create_ts,
  8.     count(*) OVER (PARTITION BY circle_id ORDER BY created_ts)                     AS __n_members,
  9.     countIf(user_role = 'Adult') OVER (PARTITION BY circle_id ORDER BY created_ts) AS adult_order
  10. FROM circles.circle_member
  11. WHERE toDate(created_ts) >= '2025-06-16'
  12. and circle_id  = 4712007
  13. order by circle_id
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement