ptime是什么型?dateselect * from test where ptime>= to_date('2010-1-2 00:10:20','yyyy-mm-dd hh24:mi:ss') and ptime <= to_date('2010-1-6 00:10:30','yyyy-mm-dd hh24:mi:ss')
是的,date类型。还得多写几个字才能回复
一个条件可以查询的语句贴出来看看 应该做转换才对oracle 日期范围查询问题 select * from aaa where to_char(rq,'yyyymmdd') between '20011101' and '20020301'; 直接在rq上加函数,如果应用大(这个表内数据很多时),查询速度会相当慢的,为了提高查询速度,强烈建议这样书写: select * from aaa where rq between to_date('2001-11-01','yyyy-MM-DD') and to_date('2002-03-01' ,'YYYY-MM-DD'); 推荐使用 select * from aaa where rq>;=to_date('2001-11-01','yyyy-MM-DD') and rq<=to_date('2002-03-01' ,'YYYY-MM-DD');用between的函数可能会慢些
应该做转换才对oracle 日期范围查询问题
select * from aaa where to_char(rq,'yyyymmdd') between '20011101' and '20020301';
直接在rq上加函数,如果应用大(这个表内数据很多时),查询速度会相当慢的,为了提高查询速度,强烈建议这样书写:
select * from aaa where rq between to_date('2001-11-01','yyyy-MM-DD') and to_date('2002-03-01' ,'YYYY-MM-DD');
推荐使用
select * from aaa where rq>;=to_date('2001-11-01','yyyy-MM-DD') and rq<=to_date('2002-03-01' ,'YYYY-MM-DD');用between的函数可能会慢些