T-SQL Split Queries

Testing content is a good thing in marketing. It’s especially appropriate for email.

Find what works best and go with it.

One way to go about that is to segment your sending audience into groups and send varying content to each group.

In the Salesforce Marketing Cloud platform, you can create those groups with queries. Here’s an example of a 20-20-80 split — two groups of 20% and the rest in the last group.

(Select the first 20% randomly)

(select 25% more of those not already selected in the first group)

(select the rest of the rows that are not in either of the first two groups)

You may be wondering if the second query is correct — 25% is not 20%. Here’s the math:

If you have a 100 subscribers and you subtract 20% — or 20 — you have 80 left.

If we want two equal groups of 20, then 20% of 80 is not 20, it’s 16. To get the correct count by percentage we’ll need to use 25% to get 20 from 80, since 80 * .25 = 20.

Also, ordering by NewID() will randomize the selection each run of the query.

For further reading:

Leave a Reply

Be the First to Comment!

Notify of