Queries

icon picker
Segment by trips

UserIDs in segment

replace count with the definition of the segment
SELECT
"UserID",
COUNT(*) AS "ActivatedTicketCount"
FROM
"Behaviours"
WHERE
"ActivatedAtUTC" BETWEEN '2024-01-31' AND '2024-02-28'
GROUP BY
"UserID"
HAVING
COUNT(*) > 19;

Count of users in segment

replace count with the definition of the segment
SELECT
COUNT(*) AS "NumberOfUsers"
FROM (
SELECT
"b"."UserID"
FROM
"Behaviours" "b"
JOIN
"UsersFromTenants" "u" ON "b"."UserID" = "u"."UserID"
WHERE
"b"."ActivatedAtUTC" BETWEEN '2024-03-27' AND '2024-04-24'
AND "u"."ConsentedAtUTC" IS NOT NULL
GROUP BY
"b"."UserID"
HAVING
COUNT(*) BETWEEN 1 AND 2
) AS SubQuery;

Want to print your doc?
This is not the way.
Try clicking the ⋯ next to your doc name or using a keyboard shortcut (
CtrlP
) instead.