SQL 查询话语脚本时间跨度

SQL 查询语句脚本时间跨度表结构yearmonth 20091200922009320094......201212现在想查出 2009-5到2012-6的

SQL 查询语句脚本时间跨度
表结构

year      month 

2009    1

2009    2

2009    3

2009    4

......

2012  12

现在想查出 2009-5  到2012-6的数据,求脚本

?

[解决办法]


select [year], [month]
 from [表名]
 where cast(rtrim([year])+'-'+rtrim([month])+'-01' as date)
 between '2009-05-01' and '2012-06-01'