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')

解决方案 »

  1.   

    假设theDate的形式:'2005-09-01'(指定日期)SELECT distinct theDate
    FROM TABLE
    WHERE substr(theDate,1,7) <=substr('2005-09-01',1,7) and 
          substr(theDate,1,7)=substr('2005-09-01',1,4)
      

  2.   

    为什么要用这么长呢?如果你的数据类型是date类型的.
    直接 看你的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')