日期:2014-05-18 浏览次数:20620 次
--虚拟临时表 with tb1 as ( select 1 as id ,2009 as v_year,5 as v_month union all select 2,2010,12 union all select 3,2011,2 union all select 4,2010,5 union select 5,2010,7 ) select * from tb1 where v_year>=year('2010-05-01') and v_month>=MONTH('2010-05-01') and v_year<=year('2011-12-01') and v_month<=MONTH('2011-12-01') /* id v_year v_month ----------- ----------- ----------- 2 2010 12 4 2010 5 5 2010 7 (3 row(s) affected */