Application Development and Automation Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 
Read only

error in inner join

Former Member
0 Likes
945

Hi All,

I have written an inner join statement as given below but it is giving an error "LOEKZ has two meanings".what could be wrong?

SELECT aBANFN aBNFPO aWERKS aEKGRP aMATNR aTXZ01 aERNAM aFRGKZ

aFRGDT aFRGST aBADAT aERDAT aEBELN aEBELP aBEDAT aSTATU

aMATKL aBEDNR aBSART aAFNAM aBSTYP aFLIEF b~KOSTL

into corresponding fields of table t_eban

from EBAN as a inner join ebkn as b

on abanfn = bbanfn

AND abnfpo = bbnfpo

where flief eq flief

and kostl eq b~kostl

and LOEKZ NE 'X'.

Thanks,

Rakesh More.

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
858

Hi

Hi in the where condn you have say LOEKZ field is from EBAN or from EBKN tables. write accordingly a or b with field like below:

SELECT aBANFN aBNFPO aWERKS aEKGRP aMATNR aTXZ01 aERNAM aFRGKZ

aFRGDT aFRGST aBADAT aERDAT aEBELN aEBELP aBEDAT aSTATU

aMATKL aBEDNR aBSART aAFNAM aBSTYP aFLIEF b~KOSTL

into corresponding fields of table t_eban

from EBAN as a inner join ebkn as b

on abanfn = bbanfn

AND abnfpo = bbnfpo

where flief eq flief

and akostl eq bkostl

and a~LOEKZ NE 'X'.

Reward points if useful

Regards

Anji

7 REPLIES 7
Read only

Former Member
0 Likes
859

Hi

Hi in the where condn you have say LOEKZ field is from EBAN or from EBKN tables. write accordingly a or b with field like below:

SELECT aBANFN aBNFPO aWERKS aEKGRP aMATNR aTXZ01 aERNAM aFRGKZ

aFRGDT aFRGST aBADAT aERDAT aEBELN aEBELP aBEDAT aSTATU

aMATKL aBEDNR aBSART aAFNAM aBSTYP aFLIEF b~KOSTL

into corresponding fields of table t_eban

from EBAN as a inner join ebkn as b

on abanfn = bbanfn

AND abnfpo = bbnfpo

where flief eq flief

and akostl eq bkostl

and a~LOEKZ NE 'X'.

Reward points if useful

Regards

Anji

Read only

Former Member
0 Likes
858

See the below code :

SELECT aBANFN aBNFPO aWERKS aEKGRP aMATNR aTXZ01 aERNAM aFRGKZ

aFRGDT aFRGST aBADAT aERDAT aEBELN aEBELP aBEDAT aSTATU

aMATKL aBEDNR aBSART aAFNAM aBSTYP aFLIEF b~KOSTL

into corresponding fields of table t_eban

from EBAN as a inner join ebkn as b

on abanfn = bbanfn

AND abnfpo = bbnfpo

where aflief eq bflief

and akostl eq bkostl

and a~LOEKZ NE 'X'.

Reward Points if it is useful

Thanks

Seshu

Read only

Former Member
0 Likes
858

Hi Rakesh,

Instead of just giving LOEKZ. Write it as aLOEKZ 'OR" bLOEKZ. The error is because of ambiguity as LOEKZ is there in both EBAN & EBKN.

Regards,

Younus

Reward Helpful Answers!!!!

Read only

Former Member
0 Likes
858

put like this

<b>and EBAN~LOEKZ NE 'X'</b>

Regards

Prabhu

Read only

Former Member
0 Likes
858

hi

it means that the field used in where clause is existing in more than one table that you have used in your select statement...so you have to specify which table's LOEKZ in your select statement...change it as follows

SELECT aBANFN aBNFPO aWERKS aEKGRP aMATNR aTXZ01 aERNAM aFRGKZ

aFRGDT aFRGST aBADAT aERDAT aEBELN aEBELP aBEDAT aSTATU

aMATKL aBEDNR aBSART aAFNAM aBSTYP aFLIEF b~KOSTL

into corresponding fields of table t_eban

from EBAN as a inner join ebkn as b

on abanfn = bbanfn

AND abnfpo = bbnfpo

where flief eq flief

and kostl eq b~kostl

and aLOEKZ NE 'X'. --> specifies eban's loekz or bloekz - ebkn's loekz

if helpful, reward

Sathish. R

Read only

former_member632991
Active Contributor
0 Likes
858

Hi,

This is because the field LOEKZ is there in both the tables , u have to give as a~LOEKZ in where condition.

Regards,

Sonika

Read only

Former Member
0 Likes
858

Hi Rakesh,

U have to take this condition also :

<b> aLOEKZ = BLOEKZ</b>

Use this code :

SELECT aBANFN aBNFPO aWERKS aEKGRP aMATNR aTXZ01 aERNAM aFRGKZ

aFRGDT aFRGST aBADAT aERDAT aEBELN aEBELP aBEDAT aSTATU

aMATKL aBEDNR aBSART aAFNAM aBSTYP aFLIEF b~KOSTL

into corresponding fields of table t_eban

from EBAN as a inner join ebkn as b

on abanfn = bbanfn

AND abnfpo = bbnfpo

<b>AND aLOEKZ = BLOEKZ</b>

where flief eq flief

and kostl eq b~kostl

and LOEKZ NE 'X'.

Reward points if helpful.

Regards,

Hemant