'지날달'에 해당되는 글 1건

declare @targetdate datetime,
@targetdate_lastmonth1 datetime,
@targetdate_lastmonth2 datetime

select @targetdate = getdate()

select @targetdate_lastmonth1 = dateadd(month,1,dateadd(m,-1,@targetdate) )-(day(@targetdate))

select @targetdate_lastmonth2 = dateadd(month,1,dateadd(m,-2,@targetdate) )-(day(@targetdate))

select @targetdate, @targetdate_lastmonth1, @targetdate_lastmonth2
Posted by 아로스
1

아로스

달력