0

This is my query:

SELECT FirstName
FROM Account_Salesforce
WHERE (dateadd(year, (2020 - year(PersonBirthdate)), PersonBirthdate) >= dateadd(day, 7, GetDate()) AND dateadd(year, (2020 - year(PersonBirthdate)), PersonBirthdate) <= dateadd(day, 14, GetDate()))

This query should give me people who have their birthday on the 28th of February, until the 6th of March. However it is giving me from the 29th and onwards, I am missing the 28th.

Any ideas?

  • I'm not very familiar with marketing cloud, but it might be a time zone problem? It's tomorrow in some places – Kasper Feb 21 at 15:15
1

I believe the problem could be that when using GetDate(), it includes the time while the values stored for PersonBirthdate would not have time so the calculated date would be something like '2020-02-28 09:22:37.113' instead of '2020-02-28 00:00:00.000'

The date 7 days in the future without time can be obtained using something like:

select dateadd(dd, datediff(dd, 0, GETDATE()), 7)
| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.