0

I have marketing cloud automation set up that puts our end users into one of 6 groups based on last character of their ID. Every month we send out an NPS Survey on the first Tuesday of every month and the second Tuesday of every month. We have used SQL to make sure when we send the reminder to the same Group - they don't get the reminder if they filled it out on the first send.

This is the SQL statement we used to prevent folks from getting it twice - unfortunately it did now work and many people got two surveys a week apart and are NOT happy.

The is the statement (it validates ok) - what is the error?

WHERE a."Group"='Group3'
AND
(b.PL_NPS_SubmissionDate > DATEADD(day, -30, getdate())
OR
b.PL_NPS_SubmissionDate is Null)

1 Answer 1

0

Currently your WHERE is taking records from Group3 that either did not fill NPS or did it within the last month.

(b.PL_NPS_SubmissionDate > DATEADD(day, -30, getdate()) captures records that filled the NPS within the last month.

It seems to be exactly the opposite of what you want to achieve.

As your SQL has a logic that you did not describe in the context, I cannot propose the exact solution. But if there is a need for a filter on whether the NPS was filled recently, I would recommend using DATEDIFF.

Also - I suspect you may want to use parentheses to group some of those conditions, but this also depends on the business context that was not provided.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .