UPDATE q51, 
       ( SELECT q51.p05 as p05, 
                q51.p06 as p06
         FROM q51
         WHERE ifnull(q51.p05, '')<>''
            && ifnull(q51.p06, '')<>''
         GROUP BY q51.p05   
       ) as q51_1
SET q51.p06=q51_1.p06, 
    q51.remdate=curdate(), 
    q51.remtime=curtime(), 
    q51.remuser='{user_pswd}'
WHERE q51.p05=q51_1.p05
   && ifnull(q51.p06, '')='';
/*peg_end*/
