比如我想查询2008年7月25日那天的记录,我应该怎么调用 to_days() ?select * from 表名 where 后面的调用 to_days() 试了几种日期的方式都报错,请指点,谢谢.

解决方案 »

  1.   

    select * from 表名 where rq>='2008-7-25'
      

  2.   

    wwwwb, mysql 里面不认 rq 这个函数呀.mysql> select * from user_accounting_history where rq>='20080725';
    ERROR 1054 (42S22): Unknown column 'rq' in 'where clause'
    mysql> select * from user_accounting_history where rq>='2008-7-25';
    ERROR 1054 (42S22): Unknown column 'rq' in 'where clause'
    mysql>
      

  3.   

    yueliangdao0608, to_days(current_date),在我的理解是指当前的日期,但取出来的值7337171不是很明白.如下: mysql> select (now());
    +---------------------+
    | (now())             |
    +---------------------+
    | 2008-11-06 09:21:14 |
    +---------------------+
    1 row in set (0.00 sec)mysql> select to_days(current_date);
    +-----------------------+
    | to_days(current_date) |
    +-----------------------+
    |                733717 |
    +-----------------------+
    1 row in set (0.00 sec)mysql>
      

  4.   

    wwwwb, 字段='日期'这种方法最早就试过了,不行.mysql> select * from user_accounting_history where call_start_time='2008-7-25';
    Empty set (0.46 sec)而这一天是有数据的.
      

  5.   

    select * from 表 where to_days('字段名')='2008-07-25'
      

  6.   

    to_days是把日期转换为一个数字
    select * from 表 where to_days('字段名')=to_days('2008-07-25')
      

  7.   

    select to_days('时间字段名') from 表名;