当前位置:网站首页>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
边栏推荐
猜你喜欢

数据清洗 ETL 工具Kettle的安装

npm ERR! network

MySQL of database -- Fundamentals

To remember the composition ~ the pre order traversal of binary tree

Leetcode题库78. 子集(递归 c实现)

Emuelec compilation summary

JS DOM event

Project upload part
![3、 6 [Verilog HDL] gate level modeling of basic knowledge](/img/36/46f2413ecb12f81c003848c93f6bc9.jpg)
3、 6 [Verilog HDL] gate level modeling of basic knowledge

STM32 and FreeRTOS stack parsing
随机推荐
Amazon cloud technology entry Resource Center, easy access to the cloud from 0 to 1
Using sqlmap injection to obtain the account and password of the website administrator
MySQL - Chapter 1 (data types in MySQL)
成功的DevOps Leader 应该清楚的3个挑战
Give the method of instantiating the object to the new object
JS what is an event? Event three elements and operation elements
JS node operation, why learn node operation
108. 将有序数组转换为二叉搜索树
如何实现根据照片获取地理位置及如何防御照片泄漏地理位置
Secrets in buffctf file 1
Go language learning notes - array | go language from scratch
ALV tree (ll LR RL RR) insert delete
Go language learning notes - structure | go language from scratch
GoLand debug go use - white record
Principle of synchronized implementation
Applet error: cannot read property'currenttarget'of undefined
Kettle实验 转换案例
重载、重写、隐藏的对比
GUI, CLI and UNIX Philosophy
RSA encryption and decryption signature verification