‎2008 May 15 2:43 PM
Hi Gurus,
I am working on a select statement, initially I have wriiten a select statement using the inner joins but then we had some performance issues and I have advised not to use joins...and after that I have written the following statement:
select:
mara~matnr
mara~means
mara~mtart
marc~werks
mard~lgort
from
mara as mara,
mard as mard,
marc as marc
where
(maramatnr = mardmatnr) and (marcmatnr = mardmatnr) and (marcwerks = mardwerks).
but when I am executing this stattement it's iving me an error :
Wrong table name or table alias name table alias name "VBSEGS". table
can you please tell me how make it right
‎2008 May 15 2:50 PM
the syntax you are using is still assuming you want a join because you are trying to get from multiple tables.
If you want to do this without joins, you will need to do your first select into an Internal Table, then do the second select
using values from the 1st table, and repeat for 3rd.
See syntax for SELECT ... FOR ALL ENTRIES IN
‎2008 May 15 2:55 PM
Hi,
Instead of giving the join conditions in the WHERE addition give it in the ON addition.
for example:
select maramatnr maktmaktx
from mara inner join makt
on maramatnr = maktmatnr.
endselect.
Regards
Naren
‎2008 May 15 3:00 PM
Hi
Instead of using select statment in your way, use for all entries to get the data from differnet tables.
Ex: MARA, MARC and MARD are Table
Select Matnr Maktx from mara into table itab1 where matnr = '1234'.
select x y from mard into table itab2 for all entries in itab1 where matnr = itab1-matnr.
same thing follows for the 3rd tale also.
Regards,
Adi
‎2008 May 15 3:02 PM
The above selection logic is also an inner join...break them into three SELECT statements using FOR ALL ENTRIES statement. Also there is some error as you have not provided the join condition using ON statement.