update d64,           
        (SELECT d64.nr01 as nr01, 
                d64.p300 as p300, 
                ifnull( (select d99102_in.p300
                         from d99102 as d99102_in
                         where d99102_in.tbl='d64'
                            && d99102_in.tbl_nr01=d64.nr01
                         order by d99102_in.dt desc, d99102_in.tm desc
                         limit 1), 0) as dp300
                         
         FROM d64
         WHERE d64.p00>={pub_arr1[1]}
            && d64.p00<={pub_arr1[2]}
        ) as tbl01
set d64.p300=tbl01.dp300, 
    d64.remdate=curdate(), 
    d64.remtime=curtime(), 
    d64.remuser='{user_pswd}'
where d64.p300<>tbl01.dp300
   && d64.nr01=tbl01.nr01;
/*peg_end*/