2007 Aug 28 2:24 PM
anybody tell how to join 5 tables .....if u have coding plz send me ........
anybody tell how to join 5 tables .....if u have coding plz send me ........
2007 Aug 28 2:26 PM
Hi..
Joining 5 tables will give performance issue...if u r very sure then only go ahead..
Message was edited by:
Dhananjay Patil
2007 Aug 28 2:29 PM
Hi,
Why dont you create Views and then use the view in your SELECT query.
Generic example of JOINING 5 tables
SELECT FLD1 FLD2 FLD3 FLD4 FLD5 INTO CORRESPONDING FIELDS OF TABLE ITAB FROM TABLE1 <b>INNER JOIN</b> TABLE2 ON TABLE1FLD1 = <b>TABLE2FLD1<b> INNER JOIN</b> TABLE3 ON TABLE2FLD2 = TABLE3FLD2 INNER JOIN</b> TABL4 ON TABLE3FLD3 = TABLE4FLD3 <b>INNER JOIN</b> TABLE5 ON TABLE4FLD4 = TABLE5FLD5 WHERE FLD1 = 'AA'.
Regards,
Sesh
2007 Aug 28 2:57 PM
HI,
There is no difference in joining 2 tables are 5 tables.. the systax goes like this.
select table1field table2field table3~field..... from table1
join table2 on table1field = table2field
join table3 on table2field = table3field........
where <your condiation> ex... table~field in s_field..
Thanks
Mahesh
2007 Aug 28 6:04 PM
hi ravi,
SAP limited joining of 3 tables maximum,and also avoid using joining fro that use for all entries.
2007 Aug 28 6:13 PM
Hi Ravi,
Dont use joins on five tables, it will impact the performence very badly.. instead use FOR ALL ENTRIES..
Proceed as follows:
SELECT xxxx
FROM xxxx
INTO tab1
WHERE selection condtions.
IF sy-subrc EQ 0
AND NOT tab1[] IS INITIAl.
SELECT yyyy
FROM yyyy
INTO tab2
FOR ALL ENTRIES IN tab1
WHERE xxx EQ tab1-xxx.
and so on.. for all the 5 tables..
Thanks and Best Regards,
Vikas Bittera.
**Points for useful answers**
| User | Count |
|---|---|
| 3 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 |