[SalesForce] Selecting Anniversary/Birthday in next month SQL

The code I'm using works until December.

Select * FROM [Date_Extension]
WHERE month(birthday) = month(getdate()) + 1

How do I add a CASE statement into this to select January when month(getdate()) + 1 = 13? Or should I be doing this a different way all together?

Best Answer

Why not try a DatePart with the DateAdd?

SELECT * FROM [Data Extension] WHERE
DATEPART(mm,birthday) = DATEPART(mm,(DateAdd(m,1,GetDate()))

This will take the recipient's birthday month and match it to the following month

Related Topic