zoukankan      html  css  js  c++  java
  • ABAP CDS ON HANA-(7)CDSビューでの集約

    Aggregate expression in CDS View

    An aggregate expression calculates a single value from an operand operand by calling an aggregate function from multiple rows of a results set. They need Group By clause to aggregate values from multiple rows and  the non-aggregated fields  are specified in the GROUP BY clause.

    Aggregate Functions:

    0

    Created a CDS view with below select with SUM function.

    1


    @AbapCatalog.sqlViewName: ‘ZFLIGHT_VW’
    @AbapCatalog.compiler.compareFilter: true
    @AccessControl.authorizationCheck: #CHECK
    @EndUserText.label: ‘Flight View with Aggregation Operation’
    define view Zflight_View 
    as select from sflight
    {
    key sflight.carrid, 
    key sflight.connid, 
    sum( price ) as Total_Amount,
    sflight.currency
    } group by carrid, connid, currency
    

      


    Data Preview:

    2

    CDS view with SUM & COUNT functions

    3


    @AbapCatalog.sqlViewName: ‘ZFLIGHT_VW’
    @AbapCatalog.compiler.compareFilter: true
    @AccessControl.authorizationCheck: #CHECK
    @EndUserText.label: ‘Flight View with Aggregation Operation’
    define view Zflight_View 
    as select from sflight
    {
    key sflight.carrid, 
    key sflight.connid, 
    sum( price ) as Total_Amount,
    sflight.currency,
    count( *) as Lines
    } group by carrid, connid, currency
    

      


    Data Preview

    4


    SFLIGHT Table contents

    5

  • 相关阅读:
    ADERA3 省选模拟赛 SPOJ LMCONST
    TYVJ 1730 二逼平衡树 线段树套平衡树
    BZOJ 1059 [ZJOI2007]矩阵游戏 二分图匹配
    BZOJ 1056 [HAOI2008]排名系统 Splay+Hash
    OI教会我的
    BZOJ 1055 [HAOI2008]玩具取名 DP
    BZOJ 1058 [ZJOI2007]报表统计 Splay
    为自己而奋斗
    [总结]高斯消元&XOR方程
    我 的 2013
  • 原文地址:https://www.cnblogs.com/yjyongil/p/10496526.html
Copyright © 2011-2022 走看看