如何查询一个数据库中一个月内的数据?不是一个月的间隔,而是按照月查询
比如查询12月的时候,
列出12月内的所有数据   

解决方案 »

  1.   

    select count(*) from `table` where date>='2009-12-00' and date <='2009-12-31'试试,我一般这么操作天数,月份没测速过
      

  2.   


    select * from tablename where date_format(date,'%Y-%m')='2009-12';
      

  3.   

    select * from tablename where substr(date,1,7)='2009-12';
      

  4.   

    用sql语句中的like查询,比如like '2009-12%'