update agenda_resposta_formulario a, agenda_tarefa b set a.tarefa = b.id where a.tarefa = b.idOriginal - ; update agenda_resposta_desenvolvimento_equipe a, agenda_tarefa b set a.tarefa = b.id where a.tarefa = b.idOriginal - ; insert into agenda_tarefa (idPrimario, assunto, vendedor, dataCriacao, dataInsercao, data, horario_inicial, horario_final, usuario, supervisor, idOriginal, observacao, clientes, resumo, status) select date_format(now(),'%Y%m%d%H%i%s') * -1, 999, b.vendedor, curdate(), now(), a.prazo, '08:00:00', '08:00:00', b.supervisor, b.supervisor, date_format(now(),'%Y%m%d%H%i%s') * -1, a.acao, '', '', 'Pendente' FROM agenda_resposta_desenvolvimento_equipe a, agenda_tarefa b where a.tarefaAgendada is null and a.tarefa = b.id ; - ; update agenda_tarefa set idPrimario = id where idPrimario = idOriginal; - ; update agenda_resposta_desenvolvimento_equipe aa set aa.tarefaAgendada = 1 where aa.tarefaAgendada is null; - ;