select condition as old_condition_id from survey_branches where branch_id=:branch_id update survey_branches set condition=null where branch_id=:branch_id delete from survey_conditions where condition_id=:old_condition_id insert into survey_conditions (condition_id, question_id, choice_id, boolean_answer) values (:condition_id, :question_id, :choice_id, :boolean_answer) update survey_branches set condition=:condition_id where branch_id=:branch_id