Breaking Down an Oracle SQL Interview Question

preview_player
Показать описание


More from Jay:
Рекомендации по теме
Комментарии
Автор

I think the query will not work if impression 1; they are excited, but in impression 2, for the same campaign, they are bored. A1 will grab the first value and won't join because a1.ds<a2.ds. I think this works:
with most_recent as
(select
user_id,
campaign_id,
max(ds) as most_recent_impression
from ad_impressions
group by
user_id,
campaign_id
)
select
mr.user_id,
mr.campaign_id
from most_recent mr
left join
ad_impressions ad on mr.user_id = ad.user_id
and mr.campaign_id = ad.campaign_id
and mr.impression_id != ad.impression_id
where mr.impression_id <> 'BORED'
and ad.user_id is null

LobmanTheLobster
Автор

hello brother how are you? please 🙏🙏 reply me brother (i am from India) love you bro ❤️❤️❤️❤️

ramraj