select id_c as contact_id, member_id_c, date_entered from contacts_cstm, contacts where member_id_c != 'duplicate' AND  id = id_c and id_c in (select distinct se_documentinteractions_contactscontacts_ida FROM se_documentinteractions_contacts_c WHERE se_documentinteractions_contactscontacts_ida IN (select id FROm contacts c, contacts_cstm cs where c.id = cs.id_c and cs.member_id_c not like '%partner%' and c.date_entered > '2016-01-01' AND c.id NOT IN (select cr.contacts_se_relationships_1contacts_ida from contacts_se_relationships_1_c cr, contacts c where c.deleted = 0 and cr.deleted=0 and c.id = cr.contacts_se_relationships_1contacts_ida AND c.date_entered > '2016-01-01' group by cr.contacts_se_relationships_1contacts_ida having count(cr.id)>0)) AND se_documentinteractions_contacts_c.deleted = 0 ORDER BY date_modified ASC) AND id_c IN (select bean_id FROM email_addr_bean_rel WHERE bean_module = 'Contacts' AND deleted = 0)  ORDER BY date_entered;
