nadeenibrahim
8/23/2018 - 4:53 PM

Browser/candidate conversion

select count(case when candidates is not null then browser_uuid else null end) as browsers_to_candidate
	, count(*) as browsers
from (	
	select distinct r.browser_uuid 
		, candidates
	from raw_events as r
	left join (
		select browser_uuid
			, count(distinct actor_id) as candidates
		from raw_events 
		where actor_id in (select id from users where type = 'Candidate' and created_at >= '2018-08-01')
		and created_at >= '2018-08-01'
		group by 1
	) as c
	on c.browser_uuid = r.browser_uuid
	where r.actor_id in (select id from users where type = 'Candidate')
	and r.created_at >= '2018-08-01'
)