select top 20 * from
(
select PromotionRateAmount,(cast(year(ReserveDate) as varchar(4))+cast(month(ReserveDate) as varchar(2))) as MonthSum,OrderId
from [PAAmountAndDay] WITH(NOLOCK)
where orderid in (select distinct orderid from [FlMortgageDetailGroupByMortgageContractNoAndOrderID])
) as a
pivot(sum(PromotionRateAmount) for MonthSum in ([20151],[20152],[20153],[20154])) as b