select year(F_SJ),month( F_SJ ),count(*) from t_photo group by year(F_SJ),month( F_SJ ) order by year(F_SJ),month( F_SJ ) desc
多谢啊。 hongqi162正解 现在给分。
SELECT CONVERT(NVARCHAR(4),datepart(year,F_SJ))+'年', CONVERT(NVARCHAR(4),datepart(month,F_SJ))+'月', CONVERT(NVARCHAR(10),Count(*))+'張' FROM T_Photo GROUP BY datepart(year,F_SJ),datepart(month,F_SJ)
CONVERT(NVARCHAR(4),datepart(month,F_SJ))+'月',
CONVERT(NVARCHAR(10),Count(*))+'張'
FROM T_Photo
GROUP BY datepart(year,F_SJ),datepart(month,F_SJ)