
ALTER TABLE `task_feedback`
ADD COLUMN `schedule_id`  int(11) NULL AFTER `person_id`,
ADD COLUMN `schedule_name`  varchar(50) NULL AFTER `schedule_id`;

update task_feedback tf,task t,task_person tp,task_person_schedule tps,task_person_schedule_detail tpsd,security_company_schedule scs
set tf.schedule_id=scs.id,tf.schedule_name=scs.`name`
where tf.task_id=t.id and tp.task_id=t.id and tp.person_id=tf.person_id and tps.task_person_id=tp.id and tpsd.person_schedule_id=tps.id
and tpsd.schedule_id=scs.id and tf.task_start=scs.start_time and tf.task_end = scs.end_time