postgresql7.1
update contact_attribute_object_map set sort_order = '-1' where object_id = :object_id
select attribute_id from contact_attribute_object_map where object_id = :object_id
update contact_attribute_object_map set sort_order = :sort_order_temp where object_id = :object_id and attribute_id = :attribute_id