怎么改成从当前天 到 前三十天,而不是固定的日期
SELECT slzl/ asl DCL FROM
(
SELECT SUM
( CASE WHEN DATEDIFF( hour, A.RQ , A.YSRQ ) <= 48 THEN sl END ) slzl,
SUM ( a.sl ) asl
FROM QDDBD A
WHERE rq>='2021-05-01'and rq<='2021-05-30' and LEN(DJBH)='9'
) a
WHERE rq>='${TODAY()-30}'and rq<='${TODAY()}' and LEN(DJBH)='9'
where datediff(day,rq,getdate())<30 and datediff(day,rq,getdate())>0