答案 0 :(得分:0)
SELECT DATENAME(MONTH, GETDATE()) AS Month
FROM TABLE1 ORDER BY Month(Date)
<强>输出继电器强>
Month
-----
April
<强>演示强>
DATENAME(Transact-SQL)
返回表示指定datepart的字符串 指定的日期
<强>语法强>
DATENAME ( datepart , date )
datepart Abbreviations
year yy, yyyy
quarter qq, q
month mm, m
dayofyear dy, y
day dd, d
week wk, ww
weekday dw, w
hour hh
minute mi, n
second ss, s
millisecond ms
microsecond mcs
nanosecond ns
TZoffset tz
ISO_WEEK ISOWK, ISOWW
答案 1 :(得分:0)
您可以使用datename()
功能:
SELECT datename(mm, getdate()) as Monthname
from table t
order by 1;
答案 2 :(得分:0)
据推测,您想要的查询是这样的:
select datename(month, datecol), sum(amount)
from t
where . . .
group by datename(month, datecol)
order by min(datecol);