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

  • 相关阅读:
    stty
    ping
    read
    echo
    grep
    date
    vi与vim编辑器使用
    rename
    netstat
    input输入框的背景图片也可以这样玩
  • 原文地址:https://www.cnblogs.com/liuchuanxu/p/4707510.html
Copyright © 2011-2022 走看看