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..函数也可以
select * from table where shjianziduan between '03-11-23' and '03-11-28'
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;
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
select * from Table where to_char(时间字段,'yy-mm-dd')>='03-11-23' and
to_char(时间字段,'yy-mm-dd')<='03-11-28'
用between..and..函数也可以
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;
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