update mydt10, 
      (SELECT mydt10.nr01
       FROM c78_dels as c78
       LEFT JOIN mydt10 ON mydt10.tbl='c78'
                        && mydt10.tbl_nr01=c78.nr01
       WHERE c78.p02>=cast('{odbcdtos(nt_p01)}' as date)
          && c78.p02<=cast('{odbcdtos(nt_p02)}' as date)
          && c78.p100>={nt_p03}
          && c78.p100<={nt_p04}
          && c78.remddate>=cast('{odbcdtos(nt_p07d)}' as date)
          && c78.remddate<=cast('{odbcdtos(nt_p08d)}' as date)
          && concat(c78.remddate, c78.remdtime)>=concat(cast('{odbcdtos(nt_p07d)}' as date), '{nt_p07t}')
          && concat(c78.remddate, c78.remdtime)<=concat(cast('{odbcdtos(nt_p08d)}' as date), '{nt_p08t}')
          && {p_mydt10where} 
          && mydt10.nr01 is not null
       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*/
