update mydt10, 
      (SELECT mydt10.nr01
       FROM {p_mydt10arr[1] + '_dels'} as l92 
       LEFT JOIN mydt10 ON mydt10.tbl='{p_mydt10arr[1]}'
                        && mydt10.tbl_nr01=l92.nr01
       WHERE l92.p01>=cast('{odbcdtos(nt_p01)}' as date)
          && l92.p01<=cast('{odbcdtos(nt_p02)}' as date)
          && l92.p03>={nt_p03}
          && l92.p03<={nt_p04}
          && mydt10.nr01 is not null
          && l92.remddate>=cast('{odbcdtos(nt_p07d)}' as date)
          && l92.remddate<=cast('{odbcdtos(nt_p08d)}' as date)
          && concat(l92.remddate, l92.remdtime)>=concat(cast('{odbcdtos(nt_p07d)}' as date), '{nt_p07t}')
          && concat(l92.remddate, l92.remdtime)<=concat(cast('{odbcdtos(nt_p08d)}' as date), '{nt_p08t}')
          && l92.p03>={nt_p03}
          && l92.p03<={nt_p04}
          && {p_mydt10where} 
       GROUP BY mydt10.nr01
      ) as tbl01 
SET mydt10.remguc='{p_mydt10mark}'
WHERE mydt10.nr01=tbl01.nr01
   && (    (mydt10.p01=1 && {nt_napost}=1)
        || (mydt10.p01=2 && {nt_nparal}=1)
      );
/*peg_end*/
