------解决方案-------------------- SQL语句,SELECT DATEPART(month, GETDATE())//读取今天的月份
------解决方案-------------------- SELECT * from table where DATEPART(month, 你的时间字段)<DATEPART(month, GETDATE())
------解决方案--------------------
SQL code
declare @t table(date datetime)
insert into @t(date) select '2011-12-20 11:22:22' union all select '2012-03-11 08:24:30'
select year(date) as [年份],month(date) as [月份],datepart(month,date) as [月份1],convert(nvarchar(7),date,23) as [年月]
from @t where convert(nvarchar(7),date,23) > '2011-12'
------解决方案--------------------