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
时间: 2024-10-07 21:58:41