select type_key from ab_contact_attr_types where type_id = (select min(type_id) from ab_contact_attr_types where type_key not in (select type_key from ab_contact_attrs where contact_id = :contact_id)) select type_key from ab_contact_attr_types where type_id = (select min(type_id) from ab_contact_attr_types) select type_key, value from ab_contact_attrs where attr_id = :attr_id