풀이
with
view as (
select
user_pseudo_id,
ga_session_id
from
ga
where
event_name = 'page_view'
and page_title = '백문이불여일타 SQL 캠프 입문반'
),
scroll as (
select
user_pseudo_id,
ga_session_id
from
ga
where
event_name = 'scroll'
and page_title = '백문이불여일타 SQL 캠프 입문반')
select count(DISTINCT t1.user_pseudo_id, t1.ga_session_id) as total
,count(DISTINCT t1.user_pseudo_id, t1.ga_session_id) - count(DISTINCT t2.user_pseudo_id, t2.ga_session_id) as pv_no
,count(DISTINCT t2.user_pseudo_id, t2.ga_session_id) - count(DISTINCT t3.user_pseudo_id,t3.ga_session_id) as pv_yes_scroll_no
,count(DISTINCT t3.user_pseudo_id,t3.ga_session_id) as pv_yes_scroll_yes
from ga t1 left join view t2 on t1.user_pseudo_id = t2.user_pseudo_id and
t1.ga_session_id = t2.ga_session_id
left join scroll t3 on t2.user_pseudo_id = t3.user_pseudo_id AND
t2.ga_session_id = t3.ga_session_id
'coding > sql 코딩테스트' 카테고리의 다른 글
[solvesql] 월별 주문 리텐션 (클래식 리텐션) (0) | 2024.12.21 |
---|---|
[solvesql] 유입 채널 별 실전반 전환율 (0) | 2024.12.21 |
[리트코드] 177. Nth Highest Salary (0) | 2024.12.19 |
[프로그래머스] 재구매가 일어난 상품과 회원 리스트 구하기 (LV2) (0) | 2024.11.20 |
비트연산자 (0) | 2024.09.05 |