SET SQL_SAFE_UPDATES=0;
UPDATE attendance as ace1,
(SELECT ace.serial_ace serial_ace, scd.serial_lop serial_lop,
                scd.serial_sbc serial_sbc, scd.serial_sps serial_sps
                FROM schedule as scd
                JOIN attendance ace ON ace.serial_scd=scd.serial_scd
                WHERE ace.serial_ace IN (SELECT DISTINCT att.serial_ace FROM attendance as att)
                order by ace.serial_ace) as ace2
SET 
    ace1.serial_lop = ace2.serial_lop,
    ace1.serial_sbc = ace2.serial_sbc,
    ace1.serial_sps = ace2.serial_sps
WHERE
    ace1.serial_ace = ace2.serial_ace;
SET SQL_SAFE_UPDATES=1;