select * from employee where datediff(mm,[date],getdate())>0

解决方案 »

  1.   

    select * from employee where  convert(char(7),[date],120)>convert(char(7),getdate(),120)
      

  2.   

    我试试看,char是什么意思呀?如果是取字符串的话,如果不是10月份以上,我的是10月份以下又怎么办呢?
      

  3.   


    小于不就可以了
    select * from employee where  convert(char(7),[date],120)>convert(char(7),getdate(),120)
    select * from employee where  convert(char(7),[date],120)<convert(char(7),getdate(),120)
      

  4.   

    上面的也可以
    select * from employee
     where rq>=convert(char(10),dateadd(dy,-day(getdate())+1,getdate()),111)
    and rq<dateadd(m,1,convert(char(10),dateadd(dy,-day(getdate())+1,getdate()),111))
    但如果日期使用函数,索引无效,速度很满
      

  5.   

    convert(char(10),时间,120)这样可以直接比
    1999-01-01(10位)
      

  6.   

    select * from table1 where datepart(yy,date1)>datepart(yy,getdate()) or 
    datepart(mm,date1)>datepart(mm,getdate())