메뉴 건너뛰기

SAP 한국 커뮤니티

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

Risky 2009.09.11 18:35 조회 수 : 59385

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.

번호 제목 글쓴이 날짜 조회 수
6506 <b>[완료]</b>external alias의 대해 알려주세요~ [1] abap퍼 2008.02.26 98036
6505 [요청]스크린페인터가 되질 않습니다.. alphanumeric editor가 나와요..ㅜㅜ [15] file 피크민 2007.12.06 71009
» [re] inner join 과 sub query 의 퍼포먼스... [2] file Risky 2009.09.11 59385
6503 Multi Selection 버튼 색상 문의..<-제목이 흠.. file 김지성 2007.08.01 50546
6502 [요청]소수점 데이터를 선언시 질문입니다. [2] kkk 2008.04.17 48238
6501 <img src=2.gif border=0>Smartform 출력옵션 &field<옵션>& 중 자릿수 제한 기능에 관하여. [2] JiruMi 2009.04.20 44578
6500 [요청]클래스를 이용한 ALV에서 선택 SEL MODE문의드립니다. [2] 노력&성장 2008.04.17 35434
6499 자재번호 자동 List up..? Search help..? 기능 문의 드립니다 [2] file 아좀더 2019.06.26 30810
6498 <b>[완료]</b>Sorting시 Internal Table 이름이 가변적일때 Field symbol 사용 방법좀 가르쳐 주세요. [4] SkyDream 2007.12.05 27247
6497 ALV 에서는 에디팅 기능을 사용 할 수 없나요? [5] file 댕댕 2007.04.03 27050
6496 <b>[완료]</b>메시지가 잘립니다. [3] 김지성 2007.12.05 24368
6495 <b>[완료]</b>Mark field달기 [6] SAP폐인 2007.12.04 20586
6494 [re] <img src=1.gif>DOI 예제 따라하고 있는데요, 안되네요.. [2] 요요 2010.03.02 20203
6493 FOR ALL ENTRIES IN 질문드립니다! [5] 아좀더 2019.04.19 17392
6492 <img src=3.gif>[BSP]원하는 페이지로 값넘기고 받기(get,post) [2] 끼야호 2010.05.14 17115
6491 [요청]소수이하 0부분을 떨어버리는 것에 대해 문의드립니다. [5] 풍뎅이 2008.04.23 16312
6490 [요청]구매요청(PR) 텍스트화면 크기를 조정하려면 어떻게 해야 하나요? file 노름마치 2007.12.07 15005
6489 <b>[완료]</b>ranges 구문에 대한 정확한 의미와 사용법 [7] BEST!! 2007.11.14 14912
6488 <b>[완료]</b>[질문] sap서버에 있는 shell script를 실행시키기.. [3] 해처리 2007.12.04 14574
6487 [요청]펑션 LVC_TRANSFER_FROM_SLIS, LVC_FIELDCAT_COMPLETE의 용도가 궁금합니다. [2] 아밥맨 2008.06.10 14496