SqlServer,写存储过程用来按月统计一些数据。现在取出月份的值是用以下sql语句取出来的,但这种情况会使【Total Quotation Enquiries】某个月份为空时,整个Period的月份会乱掉。
“ select Period=case when isnull(a.month,'')='' then
(case when isnull(b.month,'')='' then c.Month else b.Month end)
else a.month end ”
请问是否有一种方式,可以动态地select出2015-06月份至今的所有月份,每个月动态变更月份