_ | 覦覈襦 | 豕蠏手 | 殊螳 | 譯殊碁
FrontPage › 襷れ殊豐覿壱手讌一危磯ゼ豌襴る

豌襴 一危磯ゼ 襷れ 豌襴る,
語覿 語蟾讌朱 一危磯ゼ 覲伎 譴 .

declare 
	@yyyy char(4)
,	@mm char(2)

set @yyyy = '2011'
set @mm = '04' --螳 4 12 企朱..

;with t
as
(
	select convert(date, '2011-04-12') date_key union all
	select convert(date, '2011-03-01') date_key union all
	select convert(date, '2011-02-01') date_key 
)
select
	left(date_key,7) + 
	case when convert(char(7), getdate()-1, 121) = @yyyy + '-' + @mm and 
		left(date_key,7) = @yyyy + '-' + @mm  then 
			'(' + @yyyy + '-' + @mm + '-01 ~ ' + convert(char(10), getdate()-1, 121) + ')' 
	else '' end
from t		
order by 1

/*
2011-02
2011-03
2011-04(2011-04-01 ~ 2011-04-12)
*/
蠍 蠍郁鍵..
企: : るジ讓曙 襦螻豺 企Ν 譯殊語. 襦螻豺
EditText : Print : Mobile : FindPage : DeletePage : LikePages : Powered by MoniWiki : Last modified 2018-04-13 23:12:53

蟆 覩語 覦 る 轟 讌 覿覈螳 覲 蟆企.