比如:起始时间:03-11-23,结束时间03-11-28.要查询出这段时间内的记录,如何实现?

解决方案 »

  1.   

    To_char函数
    select * from Table where to_char(时间字段,'yy-mm-dd')>='03-11-23' and 
    to_char(时间字段,'yy-mm-dd')<='03-11-28'
    用between..and..函数也可以
      

  2.   

    select * from table where shjianziduan between '03-11-23'  and '03-11-28'
      

  3.   

    oracle数据库:
      query.aql.add('select * from table where 时间<=');
      query.sql.add('to_date('+''''+'03-11-28'+','+''''+'yy-mm-dd'+''''+')');
      query.sql.add('and 时间>=')
      query.sql.add('to_date('+''''+'03-11-23' +','+''''+'yy-mm-dd'+''''+')');
      query.open;
      

  4.   

    SQLSERVER
    select * from table where youedate>=03-11-23 and yourdate<=03-11-28
    Access
    select * from table where youedate>=#03-11-23# and yourdate<=#03-11-28#
    当然,前提时你只是保存的日期,没有时间部分,否则要加函数控制!例如Access中为DateValue