I want to be able to search for over 300, over 350 and over 400 ( Datediff(DAY, filedate, Getdate()) > 300 ) ( Datediff(DAY, filedate, Getdate()) > 350 ) ( Datediff(DAY, filedate, Getdate()) > 400 ) in the query below. How do I add that to this query? Do I need to declare a new variable?if @doc in ('V01')Begin Select DOC, Reg, FO, CLMS, Age = Datediff(day,max(filedate), getdate()),FileDate = max(FileDate),o.mailingaddressstate as DDS,o.ddsofficecode as DDSCode,Min(ddsrcpt) AS DDSReceipt, DDSAge = Datediff(day,min(ddsrcpt), getdate()), Title = case when min(p.Title) <> max(p.Title) then 'Concurr' else min(p.Title) endFrom (select *, row_number() over (Partition by ddsrcpt order by ddsrcpt) as rownum from pendingdds) pjoin offices.dbo.doorsinfo oon o.officecode = p.fowhere doc in ('V01', 'S67', 'S41', 'S66') Group By FO, Reg, DOC, CLMSSN, o.mailingaddressstate, o.ddsofficecodeorder by p.fo, age , DDSReceipt descEnd