How to work with dates

Hello... I'm trying to build a query, which returns the sales of an item in the past one and half years.
This means that if I will run the query 10 days from today, it will relate to that date minus one and a half years.
I'm working with Sap Business One.
Can you tell me which functions I have to use and the condition?
I know basic SQL but this is a bit more complicated for me.

this is sample data

declare @thatdate date = getdate() - 2;
create table #gal(item varchar(50), saledate date)

insert into #gal
select name, create_date from sys.objects 
--the key is dateadd(mm,-42,@thatdate)
--3.5 years is 42 months
select * 
  From #gal
  where saledate <=dateadd(mm,-42,@thatdate)

drop table #gal
1 Like
select DATEADD(mm, -18, getdate()) OneAndAHalfYearsAgo


1 Like