I am trying to pull list of emails for a particular domain (which is aproblematic domain) and somehow my results does not make a sense--meaning that I'm getting way less than expected. To further test, I plugged in one JOBID that I know has 5 emails that were for this domain but only one is showing up.
select --distinct
w.domain
, w.Month_no
, w.Month_name
, w.Year_no
, w.jobID
, w.id_email
, w.EmailAddress
, case when w.id_email_sent is not null then 'Y' else 'N' end as flag_sent
, case when w.id_email_bounce is not null then 'Y' else 'N' end as flag_bounce
, case when w.id_email_open is not null then 'Y' else 'N' end as flag_open
from(select
se.subscriberkey as id_email_sent
, b.subscriberkey as id_email_bounce
, o.subscriberkey as id_email_open
, se.jobID
, DATEPART(YEAR, se.EventDate) as Year_no
, DATEPART(MONTH, se.EventDate) as Month_no
, DATENAME(MONTH, se.EventDate) as Month_name
, se.domain
, u.EmailAddress
, u.subscriberkey as id_email
from ent._SENT se
join ent._SUBSCRIBERS u on u.subscriberid = se.subscriberid
left join ent._BOUNCE b on b.subscriberid = se.subscriberid
and b.jobid = se.jobid
and b.batchid = se.batchid
and b.listid = se.listid
left join ent._OPEN o on o.subscriberid = se.subscriberid
and o.jobid = se.jobid
and o.batchid = se.batchid
and o.listid = se.listid
where u.domain = 'domain.com'
and se.jobID = 22725940
)w
where 1=1
Target DE Fields:
ent
prefix for sent, bounce and open? And why thewhere
clause at the end?