select * from 表 where 时间字段<dateadd(month,-4,getdate())

解决方案 »

  1.   

    select * from tablename where month(日期字段) between month(getdate())-4 and month(getdate())-1
      

  2.   

    sorry:
    select * from 表 where 时间字段 between dateadd(month,-4,getdate()) and dateadd(month,-1,getdate())
      

  3.   

    select * from tablename where time>=dateadd(month,-4,convert(char(8),getdate(),120)+'01')
    and time<convert(char(8),getdate(),120)+'01'
      

  4.   

    select * from aa where ddate < convert(varchar(4),year(date())) + '-' + convert(varchar(4),month(date())) + '-1') and ddate > convert(varchar(4),year(date())) + "-" + convert(varchar(4),month(date())-4) + '-1')
      

  5.   

    我的ddate > ....改成ddate >=