当前位置: 代码迷 >> Sql Server >> SQL 查询话语脚本时间跨度
  详细解决方案

SQL 查询话语脚本时间跨度

热度:71   发布时间:2016-04-24 20:55:25.0
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'
  相关解决方案