请教:在以往的插入数据中.都有一个时间字段strTime的默认值为:getdate() 
我想只取出当月的数据,怎么取出??

解决方案 »

  1.   

    select * from 表 where  year(strTime)=year({fn now()}) and month(strTime)=month({fn now()})
      

  2.   

    Select * From Table
    Where DateDiff(mm,strTime,GetDate()) = 0 
      

  3.   

    select * from tb
    where strTime> dateadd(mm,datediff(mm,0,getdate()),0)
    and strTime< dateadd(mm,datediff(mm,0,getdate()),31)
      

  4.   

    select * from table where year(strTime)=year(getdate()) and month(strTime)=month(getdate())
      

  5.   

    select * from tb
    where year(strTime)=year(getdate()) and month(strTime)=month(getdate())
      

  6.   

    DateDiff(mm,strTime,GetDate()) = 0