메뉴 건너뛰기

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.

번호 제목 글쓴이 날짜 조회 수
4027 <img src=2.gif border=0>collect 구문에 관한 고수님들의 의견을 듣고 싶습니다. [7] james80 2009.09.16 5412
4026 <img src=2.gif border=0>스탠다드 BDC중에 파일 업로드 문의드립니다.. [2] 헐크호간 2009.09.16 869
4025 <img src=3.gif border=0>Function 실행 시에 Parameter Value 값이 250 byte 가 넘을때 [2] 도움이 2009.09.15 1195
4024 <img src=3.gif border=0>1000번화면에서 첫번째 선택조건을 체크후 두번째 선택조건도 1000번 화면에서 가능할까요? [3] 들아쿠라 2009.09.14 1447
4023 <img src=2.gif border=0>Upgrade후에 POPUP_TO_CONFIRM에 관한 질문 [2] ACE 2009.09.15 1263
4022 <img src=1.gif border=0>Report writer로 만든 BS의 계정 맵핑변경 hccpi 2009.09.15 1277
4021 <img src=2.gif border=0>on change of f1~~~end on refresh 질문 [2] 츄리닝 2009.09.15 1257
4020 <img src=2.gif border=0>조건에 따른 drop down list 만들기 [1] 츄리닝 2009.09.15 1294
4019 <img src=2.gif border=0>대량 구매처마스터 변경시 lsmw 문제 [2] 아밥돌이 2009.09.14 1462
4018 <img src=3.gif border=0>SAP JCO를 사용하여 Tables Parameter를 넘기는 질문입니다. [2] koreadbs 2009.09.14 1716
4017 <img src=1.gif border=0>수출관련 펑션 질문드립니다(현재 환율 적용). 아밥입문자 2009.09.14 1049
4016 <img src=2.gif border=0>selection-options 개별값 구하는 평션? [1] 왜이랴아마추어가치 2009.09.14 1060
4015 <img src=3.gif border=0>Function ALV 편집-내부테이블에 반영 문제.. [3] JiruMi 2009.09.14 1237
4014 <img src=2.gif border=0>Tree 에서 right_click 이벤트 구현문의 [4] GG 2009.09.13 1143
4013 <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
4011 <img src=3.gif border=0>스크린에 JPG와 같은 사진 파일 올리기... [3] 안면도 2009.09.11 1407
4010 <img src=2.gif border=0>submit , call transaction관련 질문입니다. [3] 왜이랴아마추어가치 2009.09.10 1358
4009 [re] <img src=2.gif border=0>submit , call transaction관련 질문입니다. 왜이랴아마추어가치 2009.09.14 1268
4008 <img src=2.gif border=0>파워빌더에서 RFC 펑션 호출 문의 입니다. [1] 정이 2009.09.10 1970