select * from table_name 
where year(getdate())*12 + month(getdate()) - year(add_date) * 12 + month(add_date) <= 3

解决方案 »

  1.   

    getdate()获取当前时间
    datediff()获取时间差(可以是天,小时,分...等单位)
      

  2.   

    应为:
    select * from table_name 
    where (year(getdate())*12 + month(getdate()) - year(add_date) * 12 - month(add_date)) <= 3
      

  3.   

    呵呵,这个问题我刚请教过
    用DateDiff函数
      

  4.   

    select * from diary where datediff(month,in_date,getdate())<=3