Skip to content

Instantly share code, notes, and snippets.

@wvpv
Created January 26, 2021 23:53
Show Gist options
  • Save wvpv/8f49b1a2d3d3b15e262ce4022f690302 to your computer and use it in GitHub Desktop.
Save wvpv/8f49b1a2d3d3b15e262ce4022f690302 to your computer and use it in GitHub Desktop.
SFMC all subscribers in all business units
select
s.SubscriberID
, s.SubscriberKey
, s.Status
, s.EmailAddress
, s.DateUnsubscribed
, s.DateJoined
, s.DateUndeliverable
, b.businessUnitMID
, b.businessUnitName
from _subscribers s
outer apply (
select 1 businessUnitMID, 'Business Unit Name 1' businessUnitName union all
select 2 businessUnitMID, 'Business Unit Name 2' businessUnitName union all
select 3 businessUnitMID, 'Business Unit Name 3' businessUnitName union all
select 4 businessUnitMID, 'Business Unit Name 4' businessUnitName union all
select 5 businessUnitMID, 'Business Unit Name 5' businessUnitName
) b
/* name: subscribers_all */
/* target: subscribers_all */
/* action: overwrite */
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment