/********************************
      t08
********************************/
/* t01->t08 */
INSERT INTO t08 
(nr01, p01, p02, p03, p08, p06, p010, p30,
remfdate, remftime, remfuser, remdate, remtime, remuser)
SELECT t01.p302 as nr01, 
       t01.p02 as p01, 
       t01.p02t as p02, 
       t01.p01 as p03, 
       1 as p08, 
       '*#*' as p06, 
       t01.p05 as p010, 
       t01.p06 as p30,
       t01.remfdate as remfdate, 
       t01.remftime as remftime, 
       t01.remfuser as remfuser, 
       curdate()    as remdate, 
       curtime()    as remtime, 
       '{user_pswd}' as remuser 
FROM t01
LEFT JOIN t08 ON t08.nr01=t01.p302
where t01.p303 =6
   && t08.nr01 is null
GROUP BY t01.p302;   
/*peg_end*/

/* t09->t08 */
INSERT INTO t08 
(nr01, p01, p02, p08, p06, 
remfdate, remftime, remfuser, remdate, remtime, remuser)
SELECT t09.p00 as nr01, 
       t09.remdate as p01, 
       t09.remtime as p02, 
       1 as p08, 
       '*#*' as p06, 
       t09.remfdate as remfdate, 
       t09.remftime as remftime, 
       t09.remfuser as remfuser, 
       curdate()    as remdate, 
       curtime()    as remtime, 
       '{user_pswd}' as remuser 
FROM t09
LEFT JOIN t08 ON t08.nr01=t09.p00
where t08.nr01 is null
GROUP BY t09.p00;   
/*peg_end*/