查询两个年份之间的记录,用SQL语句如何实现??如:查询2004年到2006年的所有记录,SQL语句如何写?一定给分!!

解决方案 »

  1.   

    select * from tab where date between to_date('2004-01-01','YYYY-MM-DD') 
      and to_date('2006-12-31','YYYY-MM-DD')
      

  2.   

    select t.* from table_name t where t.kuribymd>='2004' and t.kuribymd<='2005'
      

  3.   

    日起最完整的话
    select * from tab where date between to_date('2004-01-01','YYYY-MM-DD') 
      and to_date('2007-01-01','YYYY-MM-DD')
      

  4.   

    或者这样:但是效率可能不怎么样 推荐用AFIC的。select * from test where to_char(cur_date,'yyyy') in('2004','2005','2006')
      

  5.   

    select * from tab where date >= to_date('2004-01-01','YYYY-MM-DD')
    and date <= to_date('2006-12-31','YYYY-MM-DD')
      

  6.   

    select * from tab where date between (to_date('2004-01-01','YYYY-MM-DD')
    and  to_date('2007-01-01','YYYY-MM-DD'))