select dateadd(day,number,convert(date,dateadd(DD,-6,getdate()),23)) as RQ
from master.dbo.spt_values where type ='P'
and number <=DATEDIFF(day, convert(date,dateadd(DD,-6,getdate()),23), GETDATE())
来源:https://www.cnblogs.com/Anthony518/p/12316435.html