CREATE OR ALTER VIEW vydex as
select ROW_NUMBER() OVER ( ORDER BY a.Periodsid ASC ) AS id,
a.Periodsid,b.organizationid,isnull(sum(b.amount),0) as heji,
(case when a.Periodsid=1 then '9月' else 0 end ) as 月
from fnayearsperiodslist a
left join fnaexpenseinfo b on a.startdate <= b.occurdate and a.enddate >= b.occurdate
where a.fnayear =(select DATENAME(YEAR,GETDATE()) )
group by a.Periodsid,b.organizationid
以上部分月的列,希望是根据Periodsid 赋值,Periodsid为1~12,对应 9~8月,这里面不考虑中间跨年等,就赋值,菜鸟求问怎么改?