select ctt.name, ctt.tree_id from category_tree_translations ctt, category_trees ct where ctt.tree_id=ct.tree_id and ctt.locale=:locale select r.target_rev_id as as_item_type_id, o.object_type from as_item_rels r, acs_objects o where r.item_rev_id = :as_item_id and r.rel_type = 'as_item_type_rel' and o.object_id = r.target_rev_id update as_item_rels set target_rev_id = :as_item_type_id where item_rev_id = :as_item_id and rel_type = 'as_item_type_rel'