메뉴 건너뛰기

SAP 한국 커뮤니티

[re] inner join 과 sub query 의 퍼포먼스...

Risky 2009.09.12 03:35 조회 수 : 60017

1. Subquery


1) A subquery is contained within a SELECT, UPDATE or DELETE statement. A subquery is formulated in the WHERE or HAVING clause, to check whether data from various datatbase tables or views fulfills certain conditions.


2) A SELECT statement with a subquery has a more restricted syntax than a SELECT statement without a subquery: SELECT ...FROM dbtab [WHERE...]  [GROUP BY...] [HAVING...]. If the subquery returns one value, standard relational operators can be used, with the exception of LIKE and BETWEEN.


3) If a subquery is used with a relational operator rather than with EXISTS, only one column can be specified in the SELECT clause of the subquery . This can be a field the database table, or an aggregate expersssion.


4) In the example above, the goal is for the subquery to return several rows with one value each. If you want to compare all values returned,use In.


5) Subquery in which fields from the main query are used in the WHERE clause are called correlated subqueries. If several subqueries are nested, a subquery can use all fields from the subqueries above it in the hierarchy.


6) Always use positive formulations for subqueries if possible, Negative formulations can cause unperformant accesses to the database if there is no suitable index.


 


2. INNER JOIN


1) In an ABAP Join, database tables are joined using the ON clause. You can use aliases for the relevant tables, as shown in the example above. You can also specify field lists (projection) and Where clause (selection) for ABAP joins.


2) Ensure that you clearly allocate the field name in the SELECT clause, in the ON clause, and in the Where clause to a table or to an alias for a table. If the database does not support Standard SQL, the ON conditions are converted to Where conditions.


3) ABAP JOINs also bypass the SAP table buffering. To implement a JOIN on a buffered table, it may be best to define a buffered datatbase view on the table.


4) If you use parentheses, an ABAP JOIN can link more than two tables.Do not join too many tables, because this increases the complexity of processing the SQL statement on the database.


5) In the example above, an INNER JOIN is implemented. Therefore, the resulting set(with a blue frame) contains only the data records with entries for field KUNNR
in both VVBAK and KKNA1.

번호 제목 글쓴이 날짜 조회 수
6546 [요청]운영자님 좋은 조언 부탁드립니다. [1] secret 한사 2008.10.02 3
6545 [re] 특정 글자 뒤의 내용을 가져 오는 법 문의. secret ecbase 2006.12.02 7
6544 <img src=2.gif>INNER JOIN & OUTTER JOIN 의 차이점을 연구하기 위한 자료들 모음. [2] secret bill 2011.02.18 11
6543 메일보낼경우 수신인과 참조인 동시 사용시 문의 file 해피소울 2025.07.02 79
6542 혹시.. 인터페이스 파일 형식 중 BAI2 파일 만들어 보신분 계실까요? 초밥 2024.06.01 142
6541 SKF 기표 취소 관련 문의 asfasf 2024.03.26 146
6540 z07_04문제  실행해 보았는데fail뜹니다. 리얼오버 2022.01.08 160
6539 SAP에서 WORD 매크로 호출시 차단 문의 [2] file 흐르링 2025.07.03 160
6538 kb11n 변형 설정 문의 [1] 정만 2024.02.06 168
6537 프린트 한페이지에 시트 맞추기 문의 [1] 쌥쌥잇 2024.05.25 182
6536 웹딘프로 환경설정 관련해서 질문있습니다 ㅇㅇㅇㅇㅇ 2022.11.22 185
6535 ALV Row 파일 저장 ~ 관련 질문 입니다. 멜론좋아 2022.10.20 186
6534 사용자의 화면 입력 값 로깅 함수 삽입 위치 문의(USER_EXIT, enhancement, modification 모두 환영) redberry 2024.06.13 191
6533 표본추출절차 변경 이력 강씨삼남매 2020.03.26 195
6532 Screen 화면을 새 창으로 띄워서 원래 창에서도 작업 가능한 방법 Aranha 2024.02.24 197
6531 BAPI_ROUTING_CREATE 실행 시 에러 파뤼타임 2024.04.16 201
6530 BAPI사용시 금액을 Internal로 입력할 방법이 있을까요?? 안녕방가르 2024.06.28 201
6529 PDA 세팅 [1] sapecc6 2023.03.16 205
6528 Z04_14 질문드려도 될까요? GV_PROG에 %_T000008은 어떻게 나오는걸까요? [3] file 리얼오버 2022.01.07 207
6527 sapnwrfc.dll 사용중이신분 계신가요? alarm 2022.02.21 209