select a.vote_id,a.vote_topic,a.vote_reason,a.from_date,a.to_date ,count(b.user_name)
   from ierp_VOTE_MASTER a,ierp_VOTE_attendee b  where a.vote_id=b.vote_id    and to_date(a.from_date,'yyyy-mm-dd')>='2011-09-24'
   and to_date(a.to_date,'yyyy-mm-dd')<='2011-10-24'   group by a.vote_id,a.vote_topic,a.vote_reason,a.from_date,a.to_date  报错: ORA-01861: 文字与格式字符串不匹配 

解决方案 »

  1.   

    select a.vote_id,a.vote_topic,a.vote_reason,a.from_date,a.to_date ,count(b.user_name) from ierp_VOTE_MASTER a,ierp_VOTE_attendee b where a.vote_id=b.vote_id and a.from_date 〉= to_date('2011-09-24','yyyy-mm-dd') and a.to_date <= to_date('2011-10-24','yyyy-mm-dd') group by a.vote_id,a.vote_topic,a.vote_reason,a.from_date,a.to_date
      

  2.   

    to_date(a.from_date,'yyyy-mm-dd')
    改成
    to_char(a.from_date,'yyyy-mm-dd')>='2011-09-24'
    或者
    a.from_date>=to_date('2011-09-24','yyyy-mm-dd')
      

  3.   

    改成这句试试呢:
    select a.vote_id,a.vote_topic,a.vote_reason,a.from_date,a.to_date ,count(b.user_name)
       from ierp_VOTE_MASTER a,ierp_VOTE_attendee b  where a.vote_id=b.vote_id    and   a.from_date>=to_date('2011-09-24','yyyy-mm-dd')
       and a.to_date<=to_date('2011-10-24','yyyy-mm-dd')   group by a.vote_id,a.vote_topic,a.vote_reason,a.from_date,a.to_date