drop table  if exists {p_mydt10tbl1};
/*peg_end*/
drop table  if exists {p_mydt10tbl2};
/*peg_end*/

create table {p_mydt10tbl1} select * from mydt10 where nr01=-1;
/*peg_end*/
create table {p_mydt10tbl2} 
select mydt11.*, 
       mydt11.tbl as ptbl, 
       mydt11.tbl_nr01 as ptbl_nr01, 
       mydt11.nr01 as l90nr01
from mydt11 
where nr01=-1;
/*peg_end*/

delete from {p_mydt10tbl1};
/*peg_end*/
delete from {p_mydt10tbl2};
/*peg_end*/

alter table {p_mydt10tbl1} 
add key (nr01),
add key (tbl, tbl_nr01);
/*peg_end*/

alter table {p_mydt10tbl2} 
add key (nr01),
add key (mydt10),
add key (l90nr01),
add key (ptbl, ptbl_nr01),
add key (tbl, tbl_nr01);
/*peg_end*/
