zoukankan      html  css  js  c++  java
  • pivot列行转换,自动计算分组,解决groupby问题


    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

  • 相关阅读:
    audio_policy.conf说明(翻译)
    Qt
    linux C
    Linux C
    Linux C
    Qt
    Qt
    JSON
    JSON
    Qt
  • 原文地址:https://www.cnblogs.com/liuchuanxu/p/4707510.html
Copyright © 2011-2022 走看看