数据库表中日期记录为2009-04-23的形式,如何用sql语句查询2009年4月份的所有记录,请帮帮我!!谢谢!!

解决方案 »

  1.   

    from Class where date between date'2009-04-01' and date'2009-04-30'
      

  2.   

    from Class where to_char('2009-04-01')='2009-04'
      

  3.   

    from ClassName where to_char('2009-04-23','YYYY-MM') = '2009-04'
      

  4.   

    错了,是这样,from Class where to_char(tm,'yyyy-mm')='2009-04'
      

  5.   

    rom ClassName where to_char('2009-04-23','YYYY-MM') = '2009-04'