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

select with inner join

Former Member
0 Likes
725

hi friends,

can we use where clause in select statement with inner join.

i am using following code which gives error (The column name "WERKS" has two meanings . .).

SELECT AMATNR ACHARG AERSDA BMENGE B~MEINS

FROM MCHA AS A INNER JOIN CHVW AS B

ON ACHARG = BCHARG

INTO TABLE T_OUTPUT1

WHERE WERKS = PLANT AND CHARG = P_CHARG.

thanks.

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
674

Yes you can use, the probelm below is both tables has werks and you have to specify which tables.

So in the where condition if you give A-WERKS OR B-WERKS should solve the problem

Mathews

5 REPLIES 5
Read only

Former Member
0 Likes
675

Yes you can use, the probelm below is both tables has werks and you have to specify which tables.

So in the where condition if you give A-WERKS OR B-WERKS should solve the problem

Mathews

Read only

Former Member
0 Likes
674

Yes you can use it.

In the above where clause give

A-WERKS OR B-WERKS and

A-CHARG OR B-CHARG.

Cheers,

Surinder

Read only

Former Member
0 Likes
674

Yes u can use where clause in select statement with inner join.

SELECT AMATNR ACHARG AERSDA BMENGE B~MEINS

FROM MCHA AS A INNER JOIN CHVW AS B

ON ACHARG = BCHARG

INTO TABLE T_OUTPUT1

WHERE WERKS = PLANT AND CHARG = P_CHARG.

" mention the table name in where condition also like awerks or bwerks.

egards

Rajendra

Read only

Former Member
0 Likes
674
SELECT A~MATNR A~CHARG A~ERSDA B~MENGE B~MEINS
FROM MCHA AS A INNER JOIN CHVW AS B
ON A~CHARG = B~CHARG
INTO TABLE T_OUTPUT1
WHERE *A~*WERKS = PLANT AND *A~*CHARG = P_CHARG.

Try to use the above code.

regards,

~Satya

Read only

Former Member
0 Likes
674

Hi Bupi Kaler,

You can use where condition.

Here problem is you could use AWERKS OR BWERKS instead of WERKS and

ACHARG or BCHARG instead of CHARG in where condition.

It will solve your problem.

by

Prasad GVK