I have a query that works except for one thing i want it to show me data for the past 12 months based on a date a user selects in a ssrs report.`
`Declare @apl as Date = '1/1/2022' ;
Declare @prop as int = 8000 ;
--*/
SELECT
tblPropsFreeRent.intProp,
tblPropsFreeRent.dtMonth,
DATENAME(m, tblPropsFreeRent.dtMonth) + ' ' + DATENAME(yyyy, tblPropsFreeRent.dtMonth) AS strDate,
intNumTimes AS intNumTimes,
tblPropsFreeRent.mnyAmount AS curAmount,
intMoveIns AS intMoveIns,
W.fltOcc AS fltOcc
FROM tblPropsFreeRent
LEFT JOIN SovranMisc.dbo.tblPropsLateFeeWaive W ON tblPropsFreeRent.intProp = W.intProp AND tblPropsFreeRent.dtMonth = W.dtMonth
WHERE
---tblPropsFreeRent.dtMonth = @Date
DATEDIFF(Month,tblPropsFreeRent.dtMonth,GETDATE()) <=13
--tblPropsFreeRent.dtMonth >= DateADD(mm,DATEDIFF(mm,0,@Date)-12,0)
and tblPropsFreeRent.intProp IN(@Prop);