回答

1

假設你沒有與日期表,你可以使用你可以做這樣的事情

SELECT * FROM (
select YEAR(getdate()) as [TimePeriod] 
UNION SELECT YEAR(getdate()) -1 
UNION SELECT YEAR(getdate()) -2 
UNION SELECT YEAR(getdate()) -3 
UNION SELECT YEAR(getdate()) -4 
) t 
ORDER By TimePeriod DESC 
相關問題