I want to make a report that only shows contacts that don't have any of the listed membership id.
The following SQL code filters the memberships, but still lists contacts that have other memberships, including the ones I want to avoid (e.g.: it shows Joe with a membership type 8, but Joe also have another membership of type 7, so I want to exclude Joe from the report).
When trying to make this with Search Builder I got the same situation.
I'm using Joomla! on that, so Drupal Views are not an option. I have the last CiviCrm version.
SELECT SQL_CALC_FOUND_ROWS contact_civireport.sort_name as civicrm_contact_sort_name, contact_civireport.id as civicrm_contact_id, membership_civireport.membership_type_id as civicrm_membership_membership_type_id, membership_civireport.join_date as civicrm_membership_join_date, mem_status_civireport.name as civicrm_membership_status_name
FROM civicrm_contact contact_civireport INNER JOIN civicrm_membership membership_civireport ON contact_civireport.id = membership_civireport.contact_id AND membership_civireport.is_test = 0
LEFT JOIN civicrm_membership_status mem_status_civireport ON mem_status_civireport.id = membership_civireport.status_id
WHERE ( mem_status_civireport.id NOT IN (1,2,3,4,5,6,7) )
ORDER BY contact_civireport.sort_name, contact_civireport.id, membership_civireport.membership_type_id
LIMIT 0, 50