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 Statement Query

Former Member
0 Likes
426

Hi,

I need to perform the following selection:

a. Based on Position Number -> select associate Pernr from PA0001

b. based on this Pernr find value of STAT2 in PA0000.

Is there an efficient way of carrying out this selection other than using 2 Select Statements?

Note Pernr field is a primary key in both tables.

3 REPLIES 3
Read only

Former Member
0 Likes
396

select pa0001~<associate pernr> from pa0001

inner join pa0000 on pa0001pernr = pa0000pernr

into table itab

where pa0001~<position number> = <Selection for position number>.

Regards,

Ravi

Read only

Former Member
0 Likes
396

Hi,

I think you can use a join to do it.

Thanks,

Sandeep.

Read only

Former Member
0 Likes
396

How about using join statement:

Since PERNR is a key field in both tables;

SELECT P0~STAT2

INTO TABLE <itab>

FROM PA0001 AS P1 INNER JOIN PA0000 AS P0

ON P1PERNR = P0PERNR

WHERE <position number condition>

Regards,

A.Singh