如果date_field有建立索引,建议sql语句如下: select * from sn where date_field>=to_date('2003-05-08', 'YYYY-MM-DD') and date_field<to_date('2003-05-14', 'YYYY-MM-DD');即5.8之后到5.14之前
select * FROM sn where to_char(to_date(data_filed,'YYYY-MM-DD'),'YYYY-MM-DD') between '2003-05-08' and '2003-05-14';
select * from sn where to_char(date_field,'YYYYMMDD') between '20030508' and '20030513';
转换成字符: To_Char(字段,格式)
转换成日期: To_Date(字段,格式)
格式: 'YYYY-MM-DD' ,'YYYYMMDD','YYYYMM' 等
select * from sn
where date_field>=to_date('2003-05-08', 'YYYY-MM-DD')
and date_field<to_date('2003-05-14', 'YYYY-MM-DD');即5.8之后到5.14之前
where to_char(to_date(data_filed,'YYYY-MM-DD'),'YYYY-MM-DD') between '2003-05-08'
and '2003-05-14';