update t10 set p0102=4;
/*peg_end*/

update t10, z_tameia_t10
set    t10.p04   = z_tameia_t10.p04, 
       t10.p040  = z_tameia_t10.p040, 
       t10.p0106 = z_tameia_t10.p0106, 
       t10.p0107 = z_tameia_t10.p0107, 
       t10.p0102 = z_tameia_t10.p0102, 
       t10.p30   = z_tameia_t10.p30, 
       t10.p0103 = z_tameia_t10.p0103, 
       t10.p0104 = z_tameia_t10.p0104 
where t10.p01=z_tameia_t10.p01;
/*peg_end*/

insert into t10
(nr01, p01 ,p00 ,p02 ,p04 ,p06,p010,p07 ,p08 ,p040,p203,p0100,p0101,
p0102, p0106,p0107,p30 ,p0103,p0104,p0201,p0202,p0203,p0204,
remdate, remtime, remuser, remfdate, remftime, remfuser)

select z_tameia_t10.nr01 as nr01, 
       z_tameia_t10.p01 as p01,
       z_tameia_t10.p00 as p00, 
       z_tameia_t10.p02 as p00,
       z_tameia_t10.p04 as p04,  
       z_tameia_t10.p06 as p06, 
       z_tameia_t10.p010 as p010,
       z_tameia_t10.p07  as p07,
       z_tameia_t10.p08  as p08,
       z_tameia_t10.p040 as p040,
       z_tameia_t10.p203 as p203,
       z_tameia_t10.p0100 as p0100,
       z_tameia_t10.p0101 as p0101,
       z_tameia_t10.p0102 as p0102,
       z_tameia_t10.p0106 as p0106,
       z_tameia_t10.p0107 as p0107,
       z_tameia_t10.p30  as p30,
       z_tameia_t10.p0103 as p0103,
       z_tameia_t10.p0104 as p0104,
       z_tameia_t10.p0201 as p0201,
       z_tameia_t10.p0202 as p0202,
       z_tameia_t10.p0203 as p0203,
       z_tameia_t10.p0204 as p0204,

       curdate() as remdate, 
       curtime() as remtime, 
       z_tameia_t10.remuser as remuser, 
       z_tameia_t10.remfdate as remfdate, 
       z_tameia_t10.remftime as remftime, 
       z_tameia_t10.remfuser as remfuser 

from z_tameia_t10
LEFT JOIN t10 ON t10.p01=z_tameia_t10.p01
WHERE t10.nr01 is null;
/*peg_end*/

