当前位置:网站首页>ABAP 7.4 SQL Window Expression
ABAP 7.4 SQL Window Expression
2022-04-23 09:31:00 【rogerix4】
1. Application scenarios
- In use OpenSQL When fetching data ; To see each date Number of seats in first class The data of , Also get all the dates Number of seats in first class Average value
2. Code
- SQL Window Expression Use key words OVER
- PARTITION BY amount to OpenSQL Medium Group By
SELECT carrid, connid, fldate, seatsocc_f, SUM( seatsocc_f ) OVER( PARTITION BY carrid, connid ) AS sum_seatsocc_f, COUNT( seatsocc_f ) OVER( PARTITION BY carrid, connid ) AS count_seatsocc_f, MIN( seatsocc_f ) OVER( PARTITION BY carrid, connid ) AS min_seatsocc_f, MAX( seatsocc_f ) OVER( PARTITION BY carrid, connid ) AS max_seatsocc_f, AVG( seatsocc_f ) OVER( PARTITION BY carrid, connid ) AS avg_seatsocc_f FROM sflight WHERE carrid = 'AA' AND connid = '0064' ORDER BY carrid, connid INTO TABLE @DATA(lt_tab). cl_demo_output=>display( lt_tab ).
3. effect
-
Here's the picture :seatsocc_f For each date Number of seats in first class The number of avg_seatsocc_f For all dates Number of seats in first class Average value
-
Be careful 1.3153846153846153E+01 For scientific counting ; stay Excel The corresponding value in is 13.1538461538461
-
The following code can be used to convert the data of scientific counting
SELECT carrid, connid, fldate, seatsocc_f, SUM( seatsocc_f ) OVER( PARTITION BY carrid, connid ) AS sum_seatsocc_f, COUNT( seatsocc_f ) OVER( PARTITION BY carrid, connid ) AS count_seatsocc_f, MIN( seatsocc_f ) OVER( PARTITION BY carrid, connid ) AS min_seatsocc_f, MAX( seatsocc_f ) OVER( PARTITION BY carrid, connid ) AS max_seatsocc_f, AVG( seatsocc_f ) OVER( PARTITION BY carrid, connid ) AS avg_seatsocc_f FROM sflight WHERE carrid = 'AA' AND connid = '0064' ORDER BY carrid, connid INTO TABLE @DATA(lt_tab). LOOP AT lt_tab ASSIGNING FIELD-SYMBOL(<fs_tab>). DATA l_char TYPE cha_class_view-sollwert. CALL FUNCTION 'QSS0_FLTP_TO_CHAR_CONVERSION' EXPORTING i_number_of_digits = 8 i_fltp_value = <fs_tab>-avg_seatsocc_f i_value_not_initial_flag = 'X' i_screen_fieldlength = 16 IMPORTING e_char_field = l_char. WRITE: / l_char. ENDLOOP.
版权声明
本文为[rogerix4]所创,转载请带上原文链接,感谢
https://yzsam.com/2022/04/202204230623503838.html
边栏推荐
- Redis 过期 key 清理删除策略汇总
- SAP 101K 411K 库存变化
- Acquisition of DOM learning elements JS
- Emuelec compilation summary
- 1 + X cloud computing intermediate -- script construction, read-write separation
- [Luke V0] verification environment 2 - Verification Environment components
- GoLand debug go use - white record
- Three ways to create objects in JS
- 653. Sum of two IV - input BST
- Colorui solves the problem of blocking content in bottom navigation
猜你喜欢
Applet error: should have URL attribute when using navigateto, redirectto or switchtab
[reading notes] Chapter 5 conditional statements, circular statements and block statements of Verilog digital system design tutorial (with answers to thinking questions)
[C language] document operation
JS what is an event? Event three elements and operation elements
Kettle experiment
npm报错 :operation not permitted, mkdir ‘C: \Program Files \node js \node_ cache _ cacache’
三、6【Verilog HDL】基础知识之门级建模
How to protect open source projects from supply chain attacks - Security Design (1)
PHP笔记(一):开发环境配置
What is monitoring intelligent playback and how to use intelligent playback to query video recording
随机推荐
To remember the composition ~ the pre order traversal of binary tree
JS DOM event
Your guide to lowering your cholesterol with TLC (continuously updated)
kernel-pwn学习(3)--ret2user&&kernel ROP&&QWB2018-core
Cloud computing competition -- basic part of 2020 competition [task 3]
Go language learning notes - structure | go language from scratch
[geek challenge 2019] havefun1
Go language learning notes - exception handling | go language from scratch
《信息系统项目管理师总结》第八章 项目干系人管理
个人主页软件Fenrus
KVM installation and deployment
Project upload part
Kettle experiment (III)
数据清洗 ETL 工具Kettle的安装
MySQL of database -- overview and installation
JSON input of Chapter 14 of kettle paoding jieniu
Yyds dry goods inventory ubuntu18 0.4 install MySQL and solve error 1698: access denied for user ''root' '@' 'localhost' '
ALV树(LL LR RL RR)插入删除
js 原型链的深入
JS prototype chain