表中字段ReportTime    Timestamp not null    报告时间加入查询今天怎么写sql语句??select * from aa where ReportTime  = 'xxx';没用吧。 改用什么函数转换的?

解决方案 »

  1.   

    SELECT *  FROM tt WHERE DATE(ReportTime)=CURDATE()
      

  2.   

    select * from aa where date_format(ReportTime,%Y-%m-%d')='2010-08-26';
      

  3.   

    select * from aa where ReportTime = 'xxx'
    这种方法好像也是可以的。大家有谁整理过这些。
      

  4.   

    select * from 表 where date(ReportTime)=CURDATE()
      

  5.   


    select * from aa where date_format(ReportTime,'%Y-%m-%d %H:%i') = date_format('xxx','%Y-%m-%d %H:%i');
      

  6.   

    flowdb=# select * from groupflowstatdu where date_format(ReportTime,'%Y-%m-%d %H:%i') = date_format('2010-08-24 00:00','%Y-%m-%d %H:%i');
    ERROR:  function date_format(timestamp without time zone, unknown) does not exist
    LINE 1: select * from groupflowstatdu where date_format(ReportTime,'...
                                                ^
    HINT:  No function matches the given name and argument types. You might need to add explicit type casts.楼上的会报错 什么意思
      

  7.   

    '%Y-%m-%d %H:%i' 时期不能用通配符吗?
      

  8.   

    select * from aa where date_format(ReportTime,'%Y-%m-%d %H:%i') = date_format(now(),'%Y-%m-%d %H:%i');