· Jan 10, 2023

Selecting for previous month (December 2022) in January 2023


I'm new to the system I'm working on, and I have a part of a statement that needs to grab the previous month.

....and MONTH(TX3.date_of_service)= MONTH(dateadd(mm,-1,GETDATE()))

However, when it hits January, I'm left with month 0.

Does anyone know a workaround to grab December of the previous year, while still functioning normally for the rest of the current year.

Thank you! 

Product version: Caché 2018.1
Discussion (4)0
Log in or sign up to continue