日期:2014-05-17 浏览次数:20504 次
-->测试数据 declare @table table([N] int,[Y] int,[R] int) insert into @table select '2012','08','20' union all select '2012','09','05' union all select '2012','09','06' --select * from @table -->测试查询 select convert(varchar,[N])+'-'+convert(varchar,[Y])+'-'+convert(varchar,[R])as 日期 from @table where convert(varchar,[N])+'-'+convert(varchar,[Y])+'-'+convert(varchar,[R])<= convert(varchar,'2012-9-6') -->测试结果 /* --------------------------------------- 日期 2012-8-20 2012-9-5 2012-9-6 */