21 lines
532 B
SQL
21 lines
532 B
SQL
select
|
|
substring(s.distinct_id similar '%#"@%#"' escape '#') as "Group",
|
|
count(distinct w.visit_id) as "Unique visits"
|
|
from
|
|
website_event as w
|
|
join
|
|
session as s
|
|
on s.session_id = w.session_id
|
|
where
|
|
w.website_id = '16e7d807-4db5-45fd-92a9-27393445a153'
|
|
and w.event_type = 1
|
|
and w.created_at between '2025-10-06' and '2025-10-10'
|
|
and s.distinct_id is not null
|
|
and s.distinct_id like '%@%'
|
|
group by
|
|
-- Aggregate by where the users go?
|
|
substring(s.distinct_id similar '%#"@%#"' escape '#')
|
|
order by
|
|
"Unique visits" desc
|
|
;
|