Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save wvpv/8678ea474e0d87e6adacf8ecd17e1aee to your computer and use it in GitHub Desktop.
Save wvpv/8678ea474e0d87e6adacf8ecd17e1aee to your computer and use it in GitHub Desktop.
sfmc-deduplication-with-row-number-partition.sql
select
x.emailaddress
, x.subscriberkey
from (
select
w.emailaddress
, w.subscriberkey
, w.insertDate
, row_number() over (partition by w.subscriberkey order by w.insertDate asc) ranking
from Welcome_Trigger w
) x
where x.ranking = 1
and x.insertDate >= convert(date,getDate()-30)
and x.insertDate < convert(date,getDate()-29)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment