메뉴 건너뛰기

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.

번호 제목 글쓴이 날짜 조회 수
2507 <img src=3.gif border=0>sort 구문에서 by절 없이 쓰면?? [4] GoodAbap 2009.09.07 1067
2506 <img src=3.gif border=0>class로 Grid 생성시 문제점입니다. [2] 아밥돌이 2009.09.08 970
2505 <img src=3.gif border=0>[BADI] 사용자가 전표를 수정시 체크를 행하는 처리의 추가. [6] JiruMi 2009.09.08 1413
2504 [re] <img src=3.gif border=0>인터널테이블의 필드명을 동적으로 가져 올 수 있는 방법 [2] 정군 2009.09.08 1428
2503 <img src=2.gif border=0>스탠다드 메뉴바에 관한 질문입니다. [1] 아밥돌이 2009.09.09 1052
2502 <img src=2.gif border=0>화면 이동하는 방법 쫌 갈켜주세요 [2] 아밥고지를 찾아서 2009.09.09 1325
2501 <img src=2.gif border=0>ALV에서 스크롤바 내리면 새로운 라인 생성하는 방법이 있나요? [2] 멀고도험한 2009.09.09 1190
2500 <img src=3.gif border=0>클래스내에서 like와 헤더라인있는 itab 사용못하는 이유가 뭔가요? [2] 아밥맨 2009.09.10 1059
2499 <img src=2.gif border=0>자동으로 엔터 이벤트를 발생시키고 싶습니다. ^^ [8] 소망하나 2009.09.10 2721
2498 <img src=3.gif border=0>혹시... INSERT REPORT 써보신 분중에... [3] 無念군 2009.09.10 1174
2497 <img src=3.gif border=0>validation(유효성 점검) 질문드려요. [4] file 하늘사랑 2009.09.10 2050
2496 <img src=2.gif border=0>파워빌더에서 RFC 펑션 호출 문의 입니다. [1] 정이 2009.09.10 1970
2495 <img src=2.gif border=0>submit , call transaction관련 질문입니다. [3] 왜이랴아마추어가치 2009.09.10 1358
2494 <img src=3.gif border=0>스크린에 JPG와 같은 사진 파일 올리기... [3] 안면도 2009.09.11 1407
2493 <img src=3.gif border=0>inner join 과 sub query 의 퍼포먼스... [2] GoodAbap 2009.09.11 1095
» [re] inner join 과 sub query 의 퍼포먼스... [2] file Risky 2009.09.11 59400
2491 <img src=2.gif border=0>Tree 에서 right_click 이벤트 구현문의 [4] GG 2009.09.13 1143
2490 <img src=3.gif border=0>Function ALV 편집-내부테이블에 반영 문제.. [3] JiruMi 2009.09.14 1237
2489 [re] <img src=2.gif border=0>submit , call transaction관련 질문입니다. 왜이랴아마추어가치 2009.09.14 1268
2488 <img src=2.gif border=0>selection-options 개별값 구하는 평션? [1] 왜이랴아마추어가치 2009.09.14 1060