select * from ams_lists where list_id = :list_id select attribute_id from ams_list_attribute_map where list_id = :list_id select pretty_name, description, description_mime_type from ams_lists where list_id = :from_id insert into ams_list_attribute_map (list_id,attribute_id,sort_order,required_p,section_heading) ( select :to_id, attribute_id, sort_order, required_p, section_heading from ams_list_attribute_map where list_id = :from_id ) select '1' from ams_list_attribute_map where list_id = :to_id limit 1 select '1' from ams_lists where package_key = :package_key and object_type = :object_type and list_name = :list_name select list_id from ams_lists where package_key = :package_key and object_type = :object_type and list_name = :list_name delete from ams_list_attribute_map where list_id = :list_id and ( attribute_id = :attribute_id or sort_order = :sort_order ) select ams_list__attribute_map ( :list_id, :attribute_id, :sort_order, :required_p, :section_heading ) select sort_order from ams_list_attribute_map where list_id = :list_id order by sort_order desc limit 1 delete from ams_list_attribute_map where list_id = :list_id and attribute_id = :attribute_id update ams_list_attribute_map set required_p = 't' where list_id = :list_id and attribute_id = :attribute_id update ams_list_attribute_map set required_p = 'f' where list_id = :list_id and attribute_id = :attribute_id select attribute_id from ams_list_attribute_map where list_id = :list_id order by attribute_id