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

  • 相关阅读:
    ExtJs系列教程
    linux 服务器时间 timedatectl命令时间时区操作详解
    aws CloudWatch Events
    AWS Shield
    aws ssm指令
    failed to set bridge addr: "cni0" already has an IP address different from 10.244.0.1/24
    AWS Systems Manager
    Amazon Inspector
    AWS 安全培训
    Amazon Inspector
  • 原文地址:https://www.cnblogs.com/yjyongil/p/10496526.html
Copyright © 2011-2022 走看看