date2005-3-11
2005-02-11
.
.
. 数据库里有这两种格式的数据.我想查出大于等于2005年2月份的数据怎么查.我试了一下.date>='2005-02' 和date>='2005-2'查出来的不一样.谢谢.

解决方案 »

  1.   

    select sysdate-100 from dual 计算出是那一天
    select * from table where optdate>sysdate-100
      

  2.   

    SELECT *  FROM  TABLE  
    WHERE  
    date > '2005' and substr(date,1,4)='2005'
    and to_number(substr(date,instr(date,'-')+1,instr(date,'-',-1)-instr(date,'-')-1)) >= 2 
      

  3.   

    select * from table where date > substr(todate(2005-02-11,'yyyy-mm-dd'),1,7)
      

  4.   

    select * from table where date > substr(to_char(to_date(2005-02-11,'yyyy-mm-dd')),1,7)