asp+access 中查询上一周数据的 SQL语句

网上搜了好多,但是一直做不出来。求高手帮助
2024-12-19 23:43:40
推荐回答(4个)
回答1:

经ACCESS数据库测试,可以使用datepart()函数,楼上的:where datepart('ww',日期字段) = datepart('ww',now())-1

回答2:

select ShipRequestDate from dbo.OrderDetail
where ShipRequestDate between DATEADD(w, -(datepart(w,'2010-05-12')-1), '2010-05-12')
and DATEADD(W,7,DATEADD(w, -(datepart(w,'2010-05-12')-1), '2010-05-12'))

回答3:

where datepart('ww',日期字段) = datepart('ww',now())-1

回答4:

Select * from * where logtime between date()-weekday(date())-5 and date()-weekday(date())