日期:2014-05-18 浏览次数:20546 次
SELECT * FROM TB WHERE [DATE] BETWEEN CONVERT(datetime,CONVERT(char(8),DATEADD(MM,-1,[DATE]),120)+'1') AND DATEADD(Day,-1,CONVERT(char(8),DATEADD(Month,1,[DATE]),120)+'1')
------解决方案--------------------
楼上牛B
------解决方案--------------------
select * from tbl where year(date)=year(getdate()) and month(date) in (month(getdate())-1,month(getdate()))
------解决方案--------------------
select * from A.dbo.TB where datediff(mm,getdate(),date) in (0,-1) and datepart(yy,date) = datepart(yy,getdate())
------解决方案--------------------
select * from test where date between (select cast((convert(varchar(20),dateadd(m,-1,getdate()),102))as datetime)) and getdate()