昨天的现在到今天的现在:
select * from [table] where datefield>=dateadd(d,-1,getdate())
個月的今天到這個月的今天:
select * from [table] where datefield>=dateadd(m,-1,getdate())记得给分哦~@_@~

解决方案 »

  1.   

    昨天的现在到今天的现在:
    今天=now 
    昨天=今天-1
    select * from yourtab where 日期字段 bettween #" & 昨天 & "# and #" & 今天 & "#"上月的今天到本月的今天:
    本月今天=now
    day1=day(本月今天)
    month1=month(本月今天)
    year1=year(本月今天)
    nonth2=month1-1
    if month2=0 then
     month2=12
     year2=year1-1
    end if上月今天=dateserial(year2,month2,day1)
    select * from yourtab where 日期字段 bettween #" & 上月今天 & "# and #" & 本月今天 & "#"注:
     1.以上语句适用于Jet(access)数据库,如果用于SQL Server 可能要把 '#' 换成 "'".
     2.未考虑每月具体天数,自己改改吧.
      

  2.   

    happyjoe兄的对于一天查询写法稍有问题。
    如果你用的是sql server的话。可以这样写的:
    select * from [table] where datefield>=(getdate()-1)
    就行了。