mysql  从数据库中筛选出 符合 (当前时间-数据库中date)>24个月  
       数据库中含有多条记录
       这是我自己做的 select * from table where(select PERIOD_DIFF(date_format(now(),'%Y%m'),date_format(ANY(select period from test.cardaccount c),'%Y%m')))>24;
这样会提示 “Subquery returns more than 1 row”
       谢谢 在线等

解决方案 »

  1.   

    select period from test.cardaccount where .... 加入条件
      

  2.   

    24个月不就是2年么?select * from table where year(ttime)< year( CURRENT_DATE())-4;
      

  3.   

    where month(now())-month(数据库中date)>24
      

  4.   

    select * from table1 where 数据库中date<now()-interval 24 month
      

  5.   


     select * from tableName where date_add(period,interval 24 month) < now(); 
    (当前时间-数据库中date)>24个月  ,也就是数据库中日期加上24个月,仍然小于当前日期。楼主是不是想的复杂了些。