一 select * from ldy where 1=1 and goodDate > '2008'
二 select * from ldy where 1=1 and goodDate > '20080506'
三 select * from ldy where 1=1 and goodDate > '200804'前两条都能查出来,
为什么,第三条的结果为空。

解决方案 »

  1.   

    此回复为自动发出,仅用于显示而已,并无任何其他特殊作用
    楼主【ldy214】截止到2008-06-30 11:53:11的历史汇总数据(不包括此帖):
    发帖数:50                 发帖分:1265               
    结贴数:50                 结贴分:1265               
    未结数:0                  未结分:0                  
    结贴率:100.00%            结分率:100.00%            
    敬礼!
      

  2.   

    SQL中有‘年月‘这样的写法吗?
    我记得要么是年,要么是年月日吧
      

  3.   

    to_char(goodDate,'YYYYMM')不知可以不
      

  4.   

    select * from ldy where  goodDate like '200804%'
      

  5.   

    你最好换一下你的查询,给你参考
    1 select * from ldy where 1=1 and goodDate > '20080430'  这样不行吗?2 select * from ldy where 1=1 andCONVERT(varchar(6),goodDate ,112) > '200804' 
      

  6.   

    刚才写错了。。select * from ldy where 1=1 and goodDate > to_date('200804','YYYYMM');这个应该没错了 
      

  7.   

    谢谢 
    我用,select * from ldy where 1=1 and goodDate > '20080401' and goodDate < '20080431'
    就可以了,结贴。