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

Inner Join for Dynamic Select statement

Former Member
0 Likes
1,082

Hi All,

Can some one please help me in rewriting the below select statement where i have to remove the existing table1 by putting a dynamic table name which has the same table structure.


  select a~zfield1 
           a~zfield2
      from ztab1 as a
       inner join ztab2 as b
           on b~ztab1-zfield3 = a~ztab2-zfield3
     where a~zfield4 = 'A'.

I am looking something as below. But encountering an error when using the below statement
  select a~zfield1 
           a~zfield2
      from (v_ztab1) as a
       inner join ztab2 as b
           on b~ztab1-zfield3 = a~ztab2-zfield3
     where a~zfield4 = 'A'.
    

No Separate selects please. Please help me in rewriting the same select statement itself.

Regards,

PSK

3 REPLIES 3
Read only

Former Member
0 Likes
512

Hello, PSK

Try to put the code INTO ... in the INNER JOIN

Greetings

Read only

Former Member
0 Likes
512

Hi,

You are missing the 'INTO'.. I mean where is the resultant going to get stored... Please do the changes..

Read only

Former Member
0 Likes
512

hi,

What error you are getting ?

Also INTO is missing from the statement.

SELECT pcarrid pconnid ffldate bbookid

INTO TABLE itab

FROM ( spfli AS p

INNER JOIN sflight AS f ON pcarrid = fcarrid AND

pconnid = fconnid )

WHERE p~cityfrom = 'FRANKFURT' AND

p~cityto = 'NEW YORK' .

thanks