select count(*) as num_blocked from survey_sections where survey_id=:survey_id and block_section_p='t' select section_id from survey_sections s where survey_id=:survey_id and sort_key=1 select question_id from survey_questions q, survey_sections s where survey_id=:survey_id and q.section_id=s.section_id order by s.sort_key,q.sort_order update survey_questions set section_id =:section_id, sort_order=:new_sort_order where question_id=:question_id delete from survey_sections where survey_id=:survey_id and sort_key != 1