现在数据库里保存的是原始时间到现在的数据,想只显示去年7月到现在的数据,有什么办法啊?

解决方案 »

  1.   

    根据你的记录的时间字段取啊如:select * from table1 where col1>'2006/07/01'如果没有这个时间字段的话,那就没办法.至少得有个参照物
      

  2.   

    select * from table1 where month(col1)>'7';
      

  3.   

    select * from table1 where month(col1)>'7' and year(col1) > year(current date - 1 year)
      

  4.   

    错了,我刚才写的是db2的,
    select * from table1 where month(col1)>'7' and year(col1) > year(now()) - 1
    大概是这样,手头没有mysql,没有测试