ASP如何查询ACCESS数据库中上一周的所有记录

作者:网络 来源:佚名 更新时间:2008-08-04 15:20:22 点击:
上一星期(七天之内):
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())
这两个得到的是不是上周一和上周日的日期,如果是,那就是你的表里没有符合条件的数据。