用mysql查询当前时间至6个月前的数据怎么查询?sqlserver可以这样查 select * from table between getdate()-180 and getdate()请问mysql查询6个月之间的数据!! 

解决方案 »

  1.   

    select * from table where yourTimeColumn >CURDATE() -180;.
        [align=center]====  ====
    [/align]
    .
    贴子分数<20:对自已的问题不予重视。
    贴子大量未结:对别人的回答不予尊重。
    .
      

  2.   

    select * from table where yourTimeColumn >date_add(CURDATE() , INTERVAL 6 MONTH);.
        [align=center]====  ====
    [/align]
    .
    贴子分数<20:对自已的问题不予重视。
    贴子大量未结:对别人的回答不予尊重。
    .
      

  3.   

    推荐你看一下这些帮助
    SQL 1992
    MySQL 5.1 Reference Manual
    ActiveX Data Objects 2.5 Reference 下载
    数据库系统概论PPT.
        [align=center]====  ====
    [/align]
    .
    贴子分数<20:对自已的问题不予重视。
    贴子大量未结:对别人的回答不予尊重。
    .
      

  4.   


    select * from tablename where date_field between date_sub(now(),interval 6 month) and now();
      

  5.   

    select * from tablename
    where data_field
    between data_sub(now(),interval 6 month) and now();