2008 Nov 22 6:47 PM
Hi Gems,
I had wriiten two queries as below. Can somene tell me how do i combine the below 2 quesries into one using table aliasing or any other way?
get the func location
IF NOT IT_BUS[] IS INITIAL.
SELECT TPLNR IWERK
FROM IFLOT
INTO CORRESPONDING FIELDS OF TABLE IT_TECH
FOR ALL ENTRIES IN IT_BUS[]
WHERE TPLNR = IT_BUS-HAUS
AND FLTYP EQ 'C'.
IF IT_TECH[] IS NOT INITIAL.
obtain the Superior Func location(TPLMA) again from IFLOT
SELECT TPLNR TPLMA IWERK
FROM IFLOT
INTO CORRESPONDING FIELDS OF TABLE IT_TECH2
FOR ALL ENTRIES IN IT_TECH[]
WHERE TPLMA = IT_TECH-TPLNR
AND IWERK = P_WERKS
AND FLTYP = 'L'.
Please suggest.
thanks
Dan
2008 Nov 24 2:38 AM
Hi,
If you use a sub-query, it may effect the performance. So I think you don't need to combine these two queries.
Regards,
Chris Gu
Hi Gems,
I had wriiten two queries as below. Can somene tell me how do i combine the below 2 quesries into one using table aliasing or any other way?
get the func location
IF NOT IT_BUS[] IS INITIAL.
SELECT TPLNR IWERK
FROM IFLOT
INTO CORRESPONDING FIELDS OF TABLE IT_TECH
FOR ALL ENTRIES IN IT_BUS[]
WHERE TPLNR = IT_BUS-HAUS
AND FLTYP EQ 'C'.
IF IT_TECH[] IS NOT INITIAL.
obtain the Superior Func location(TPLMA) again from IFLOT
SELECT TPLNR TPLMA IWERK
FROM IFLOT
INTO CORRESPONDING FIELDS OF TABLE IT_TECH2
FOR ALL ENTRIES IN IT_TECH[]
WHERE TPLMA = IT_TECH-TPLNR
AND IWERK = P_WERKS
AND FLTYP = 'L'.
Please suggest.
thanks
Dan
2008 Nov 22 6:55 PM
one way can be combining the data of two of your internal tables into one final table.
and then use that table for final query.
Regards
Neha
2008 Nov 23 12:00 AM
Hi Neha Shukla,
Thanks! but I want to AVOID hitting the DB tabe IFLOT twice. Your suggestion still maked me to hit the table once again.
Any alternative idea...?
thanks
Dan
2008 Nov 23 12:34 AM
A sub-query might work, but you would end up with only one internal table.
Rob
2008 Nov 23 12:45 AM
Yes Rob that seems to be helpful. Can you please go ahead how to write that?
2008 Nov 23 6:01 PM
First, check the documentation on SELECT and give it a try. If you still have problems, get back to the forum.
Rob
2008 Nov 24 2:38 AM
Hi,
If you use a sub-query, it may effect the performance. So I think you don't need to combine these two queries.
Regards,
Chris Gu
2008 Nov 24 2:13 PM
>
> If you use a sub-query, it may effect the performance. So I think you don't need to combine these two queries.
Chris - do you have an example where a sub-query affects performance poorly?
Rob
2008 Nov 24 3:27 AM
| User | Count |
|---|---|
| 3 | |
| 2 | |
| 2 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 |