postgresql7.1 select sort_order from contact_attribute_object_map order by sort_order desc limit 1 delete from contact_attribute_object_map where object_id = :object_id and attribute_id = :attribute_id