update t01
set remguc=''
where remguc='@2del-mass@';
/*peg_end*/

update t01, 
         (SELECT t01.p303 as p303, 
                 t01.p302 as p302, 
                 max(concat(t01.remdate, t01.remtime)) as maxd, 
                 sum(1) as plit
          FROM t01, t06
          WHERE t06.p01=t01.p303
             && t06.p101=1
             && t01.p302<>0
             && t01.p303<>0
          GROUP BY t01.p303, t01.p302
          HAVING plit>1
         ) as t01_1
SET t01.remguc='@2del-mass@'
WHERE t01.p302=t01_1.p302
   && t01.p303=t01_1.p303
   && concat(t01.remdate, t01.remtime)<>t01_1.maxd;
/*peg_end*/ 