Skip to content

Instantly share code, notes, and snippets.

@MamaiRachid
Last active October 31, 2020 13:03
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save MamaiRachid/ee9a3957fa6c14e44c8b22b3ff15459b to your computer and use it in GitHub Desktop.
Save MamaiRachid/ee9a3957fa6c14e44c8b22b3ff15459b to your computer and use it in GitHub Desktop.
SELECT
comp.SubscriberKey,
comp.jobid,
eventdate,
emailname,
Domain,
ISNULL(comp.OYBAccountID,comp.AccountID) as OYBAccountID,
comp.AccountID
FROM _Complaint comp
INNER JOIN _job j ON comp.jobid = j.jobid
AND convert(date, comp.eventdate) >= dateadd(day, datediff(day, 0, getdate()) - 1, 0)
AND convert(date, comp.eventdate) < getdate()
AND ((OYBAccountID IS not null and OYBAccountID = 50000XXXX) OR (OYBAccountID IS null))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment