Skip to Content
0
Former Member
Jun 25, 2009 at 11:13 PM

Inner Join for Dynamic Select statement

570 Views

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