메뉴 건너뛰기

SAP 한국 커뮤니티

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

Risky 2009.09.11 18:35 조회 수 : 59400

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.

번호 제목 글쓴이 날짜 조회 수
6507 [요청]운영자님 좋은 조언 부탁드립니다. [1] secret 한사 2008.10.01 3
6506 [re] 특정 글자 뒤의 내용을 가져 오는 법 문의. secret ecbase 2006.12.02 7
6505 <img src=2.gif>INNER JOIN & OUTTER JOIN 의 차이점을 연구하기 위한 자료들 모음. [2] secret bill 2011.02.18 11
6504 매개변수 ID 가 SUBSCREEN 과 일반 SCREEN 에서 인식하는게 다른가요? 초밥 2024.05.02 27
6503 SKF 기표 취소 관련 문의 asfasf 2024.03.26 50
6502 BAPI_ROUTING_CREATE 실행 시 에러 파뤼타임 2024.04.15 52
6501 kb11n 변형 설정 문의 [1] 정만 2024.02.06 72
6500 read table 구문중 데이터 많을때.. [1] happy_boy 2024.04.23 75
6499 넘버레인지 interval cts에 관해서 문의드립니다. [2] happy_boy 2024.03.22 80
6498 [ABAP] CHAR TYPE 필드 MAX 값 구하기.. [2] Mckee 2024.04.24 88
6497 z07_04문제  실행해 보았는데fail뜹니다. 리얼오버 2022.01.07 93
6496 Screen 화면을 새 창으로 띄워서 원래 창에서도 작업 가능한 방법 Aranha 2024.02.23 99
6495 ALV Row 파일 저장 ~ 관련 질문 입니다. 멜론좋아 2022.10.19 112
6494 웹딘프로 환경설정 관련해서 질문있습니다 ㅇㅇㅇㅇㅇ 2022.11.21 114
6493 public method 호출 시 오류 [1] wid5785 2024.02.10 117
6492 ALV 총계/소계 상단 정렬 방법 문의 [1] 쌥쌥잇 2024.02.09 118
6491 Function Group: EINR 관련 문의 드립니다. [4] 쌥맨 2022.01.07 120
6490 abap 으로 DFS 알고리즘 구현해보신분 계실까요...? Juenkdo1 2024.03.13 124
6489 DYNP_VALUES_READ 함수 질문 [2] eeeaass 2024.02.22 125
6488 sapnwrfc.dll 사용중이신분 계신가요? alarm 2022.02.21 126