有那么几条数据2011-04-01 14:56:48
2011-04-01 14:56:48
2011-04-01 14:56:48
2011-04-01 14:56:48查询 2011-04-01有几条数据.发现有了时分秒不好查啊..请问要怎么做啊

解决方案 »

  1.   

    select date(f1),count(*) from tt group by date(f1)
      

  2.   

    or
    select date_format(f1,'%Y-%m-%d'),count(*) from tt group by date_format(f1,'%Y-%m-%d')
      

  3.   

    select count(*) from table1 where date(col1)='2011-04-01'
    或者
    select count(*) from table1 where col1 between '2011-04-01' and '2011-04-01 23:59:59第二种效率高。
      

  4.   

    select date(f1),count(*) from tt where date(f1)='2011-04-01' group by date(f1)
      

  5.   

    where date(col1)='2011-04-01'