SELECT distinct theDate
FROM TABLE
WHERE theDate between to_date('2005-01-01','yyyy-mm-dd') and to_date('2005-9-01','yyyy-mm-dd')
FROM TABLE
WHERE theDate between to_date('2005-01-01','yyyy-mm-dd') and to_date('2005-9-01','yyyy-mm-dd')
FROM TABLE
WHERE substr(theDate,1,7) <=substr('2005-09-01',1,7) and
substr(theDate,1,7)=substr('2005-09-01',1,4)
直接 看你的date格式是什么:
改为aalter session set nls_date_format='yyyy/mm/dd'
select * from tname
where theDate<=to_date('20050901','yyyy/mm/dd')
and theDate>=to_date('20040901','yyyy/mm/dd')