如何查询ACCESS数据库中上一时间段的所有记录
上一星期(七天之内):
select * from art where [now] between dateadd("ww",-1,now()) and now()
上一星期(上周一至周日):
select * from art where [now] between dateadd("d",-Weekday(Now())-5,now()) and dateadd("d",-Weekday(Now())+1,now())
上一月(上月的今天至今天):
select * from art where [now] between dateadd("m",-1,now()) and now()
上一月(1号至最后一天):
select * from art where [now] between dateserial(year(now),month(now())-1,1) and dateserial(year(now),month(now()),1-1)
测试一下:
select dateadd("d",-Weekday(Now())-5,now())select dateadd("d",-Weekday(Now())+1,now())
这两个得到的是不是上周一和上周日的日期,如果是,那就是你的表里没有符合条件的数据。