Skip to content

Instantly share code, notes, and snippets.

@garek007
Last active May 1, 2018 18:05
Show Gist options
  • Save garek007/de2d0c06983c99d8262f3fe92a6bc5a3 to your computer and use it in GitHub Desktop.
Save garek007/de2d0c06983c99d8262f3fe92a6bc5a3 to your computer and use it in GitHub Desktop.
SELECT s.JobID, s.EmailName, s.EmailSubject, count(o.SubscriberKey) as TotalOpens, count(case when isUnique = 1 then 1 else null end) as UniqueOpens
FROM _Open o
JOIN (
select JobID, EmailName, EmailSubject
from _Job
where EmailName NOT LIKE '%[_]welcome[_]%'
and (EmailName LIKE 'Newsletter[_]%')
AND DeliveredTime >= DATEADD(mm,DATEDIFF(mm,0,GETDATE())-1,0)
AND DeliveredTime < DATEADD(mm,DATEDIFF(mm,0,GETDATE()),0)
and SuppressTracking = 0
and AccountUserID not in (7232964)
)s
on o.JobID = s.JobID
group by s.JobID,s.EmailName,s.EmailSubject
having count(o.SubscriberKey) > 165
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment