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

Left Out join.....

Former Member
0 Likes
699

hi alll

i have written left out join coding

zaset_details has 50 records.

zasset_flag has 5 records -

Primary key assetno

SELECT A~ASSETNO INTO ASSETNO-ASSETNO FROM ZASSET_DETAILS AS A LEFT OUTER JOIN ZASSET_FLAG AS B

ON AASSETNO EQ BASSETNO

WHERE AASSETYPE = 'Laptop' and BASSETFLG eq '0'.

.

write 😕 assetno-assetno.

endselect.

while running that coding, following error occured.

"No fields from the right-hand table of a LEFT OUTER JOIN may appear in

the WHERE condition: "B~ASSETFLG"."

anyone help me

5 REPLIES 5
Read only

Former Member
0 Likes
663

Hi,

Donot give b~assetflg condition in where clause instead select it into ITAB and then filter it.

Jogdand M B

Read only

Former Member
0 Likes
663

Going by the error you cannot use B~ASSETFLG eq '0'. in the where condition

Try with inner join

Read only

Former Member
0 Likes
663

Hi,

Just use Inner Join as below.

SELECT A~ASSETNO INTO ASSETNO-ASSETNO FROM ZASSET_DETAILS AS A <b>INNER JOIN</b> ZASSET_FLAG AS B

ON AASSETNO EQ BASSETNO

WHERE AASSETYPE = 'Laptop' and BASSETFLG eq '0'.

Regards,

Ram

Read only

former_member632991
Active Contributor
0 Likes
663

Hi,

In the left outer join , u can not put condition on right hand table

SELECT A~ASSETNO INTO ASSETNO-ASSETNO FROM ZASSET_DETAILS AS A LEFT OUTER JOIN ZASSET_FLAG AS B

ON AASSETNO EQ BASSETNO

WHERE AASSETYPE = 'Laptop' and <b>BASSETFLG eq '0'.</b>.

Regards,

Soniks

Read only

Former Member
0 Likes
663

Hi Muthu,

We cannot give the field for the right hand table in the condition. Because.

- left outer join will get everything which is on the left.

- where condition should be on left and table and on condition on right hand table.

- on left outer join... if you have no entries in the right hand table matching to the left hand table then it joins the table but gives a null entry correpsong to d missg value...

So, that is the reason you are getting that error... please read help on joins and will will get a pictorial solution to you problem.

Regards,

Jayant

Please award if helpful