--前一天,给定日期的前一天
SELECT DATEADD(DAY,-1,@Date) AS '前一天'
--后一天,给定日期的后一天
SELECT DATEADD(DAY,1,@Date) AS '后一天'
--前一月
SELECT * FROM apphistory
WHERE CONVERT(VARCHAR(10),addtime,23)
<= CONVERT(VARCHAR(10),DATEADD(mm,-1,GETDATE()),23)
SELECT CONVERT(VARCHAR(10),DATEADD(YY,-1,GETDATE()),23) AS '前一年'