Unless I am missing something - this is not as hard as everyone is making it:
Declare @currentMonth datetime = datetimefromparts(year(getdate()), month(getdate()), 28, 0, 0, 0, 0);
Declare @startDate datetime = dateadd(month, -2, @currentMonth)
, @endDate datetime = dateadd(month, -1, @currentMonth);
Select @startDate, @endDate;
--==== Your Query
Select ...
From {your Table}
Where [Date] >= dateadd(day, 1, @startDate)
And [Date] < dateadd(day, 1, @endDate);
If your date column is a datetime - the above will work. It will include from the prior 28th date + 1 (March 1st for non-leap years or Feb 29th for leap years), up to but not including the 29th of the previous month.
This logic works for the date data type also
Declare @currentMonth date = datefromparts(year(getdate()), month(getdate()), 28);
Declare @startDate date = dateadd(month, -2, @currentMonth)
, @endDate date = dateadd(month, -1, @currentMonth);
Select @startDate, @endDate;
--==== Your Query
Select ...
From {your Table}
Where [Date] >= dateadd(day, 1, @startDate)
And [Date] < dateadd(day, 1, @endDate);
For @startDate - we get '2021-08-28 00:00:00.000' and @endDate we get '2021-09-28 00:00:00.000'. The query then adds 1 day to each variable and the query uses >= '2021-08-29 00:00:00.000' and < '2021-09-29 00:00:00.000'.
If we set our current date to April 28 2021 - we get 2021-02-28 for the start date and we include everything from 2021-03-01. If we set current date to '2020-04-28' we get the same start date, but the range starts at 2020-02-29.