- Notifications
You must be signed in to change notification settings - Fork 1.3k
/
Copy path_1809.sql
13 lines (10 loc) · 634 Bytes
/
_1809.sql
1
2
3
4
5
6
7
8
9
10
11
-- Write your PostgreSQL query statement below
-- my completely original solution
with sessions_with_ads as (selectp.customer_id, p.session_id, p.start_time, p.end_time, a.timestampas ts, a.ad_id
from Playback p
inner join Ads a
onp.customer_id=a.customer_idand
a.timestamp between p.start_timeandp.end_time)
select distinct(session_id)
from (select distinct(session_id) from Playback)
where session_id not in (select distinct(session_id) from sessions_with_ads)