civicrm_domain|SELECT civicrm_domain.id FROM civicrm_domain WHERE civicrm_domain.id = 1
civicrm_location_type|SELECT civicrm_location_type.id FROM civicrm_domain,civicrm_location_type WHERE civicrm_location_type.domain_id = civicrm_domain.id AND civicrm_domain.id = 1
civicrm_location|SELECT civicrm_location.id FROM civicrm_domain,civicrm_location_type,civicrm_location WHERE civicrm_location.location_type_id = civicrm_location_type.id AND civicrm_location_type.domain_id = civicrm_domain.id AND civicrm_domain.id = 1
civicrm_phone|SELECT civicrm_phone.id FROM civicrm_domain,civicrm_location_type,civicrm_location,civicrm_phone WHERE civicrm_phone.location_id = civicrm_location.id AND civicrm_location.location_type_id = civicrm_location_type.id AND civicrm_location_type.domain_id = civicrm_domain.id AND civicrm_domain.id = 1
civicrm_phonecall|SELECT civicrm_phonecall.id FROM civicrm_domain,civicrm_location_type,civicrm_location,civicrm_phone,civicrm_phonecall WHERE civicrm_phonecall.phone_id = civicrm_phone.id AND civicrm_phone.location_id = civicrm_location.id AND civicrm_location.location_type_id = civicrm_location_type.id AND civicrm_location_type.domain_id = civicrm_domain.id AND civicrm_domain.id = 1 UNION SELECT civicrm_phonecall.id FROM civicrm_domain,civicrm_contact,civicrm_phonecall WHERE civicrm_phonecall.source_contact_id = civicrm_contact.id AND civicrm_contact.domain_id = civicrm_domain.id AND civicrm_domain.id = 1
civicrm_address|SELECT civicrm_address.id FROM civicrm_domain,civicrm_location_type,civicrm_location,civicrm_address WHERE civicrm_address.location_id = civicrm_location.id AND civicrm_location.location_type_id = civicrm_location_type.id AND civicrm_location_type.domain_id = civicrm_domain.id AND civicrm_domain.id = 1
civicrm_email|SELECT civicrm_email.id FROM civicrm_domain,civicrm_location_type,civicrm_location,civicrm_email WHERE civicrm_email.location_id = civicrm_location.id AND civicrm_location.location_type_id = civicrm_location_type.id AND civicrm_location_type.domain_id = civicrm_domain.id AND civicrm_domain.id = 1
civicrm_group_contact|SELECT civicrm_group_contact.id FROM civicrm_domain,civicrm_location_type,civicrm_location,civicrm_email,civicrm_group_contact WHERE civicrm_group_contact.email_id = civicrm_email.id AND civicrm_email.location_id = civicrm_location.id AND civicrm_location.location_type_id = civicrm_location_type.id AND civicrm_location_type.domain_id = civicrm_domain.id AND civicrm_domain.id = 1 UNION SELECT civicrm_group_contact.id FROM civicrm_domain,civicrm_location_type,civicrm_location,civicrm_group_contact WHERE civicrm_group_contact.location_id = civicrm_location.id AND civicrm_location.location_type_id = civicrm_location_type.id AND civicrm_location_type.domain_id = civicrm_domain.id AND civicrm_domain.id = 1 UNION SELECT civicrm_group_contact.id FROM civicrm_domain,civicrm_mapping,civicrm_saved_search,civicrm_group,civicrm_group_contact WHERE civicrm_group_contact.group_id = civicrm_group.id AND civicrm_group.saved_search_id = civicrm_saved_search.id AND civicrm_saved_search.mapping_id = civicrm_mapping.id AND civicrm_mapping.domain_id = civicrm_domain.id AND civicrm_domain.id = 1 UNION SELECT civicrm_group_contact.id FROM civicrm_domain,civicrm_contact,civicrm_group_contact WHERE civicrm_group_contact.contact_id = civicrm_contact.id AND civicrm_contact.domain_id = civicrm_domain.id AND civicrm_domain.id = 1 UNION SELECT civicrm_group_contact.id FROM civicrm_domain,civicrm_group,civicrm_group_contact WHERE civicrm_group_contact.group_id = civicrm_group.id AND civicrm_group.domain_id = civicrm_domain.id AND civicrm_domain.id = 1
civicrm_mailing_event_queue|SELECT civicrm_mailing_event_queue.id FROM civicrm_domain,civicrm_location_type,civicrm_location,civicrm_email,civicrm_mailing_event_queue WHERE civicrm_mailing_event_queue.email_id = civicrm_email.id AND civicrm_email.location_id = civicrm_location.id AND civicrm_location.location_type_id = civicrm_location_type.id AND civicrm_location_type.domain_id = civicrm_domain.id AND civicrm_domain.id = 1 UNION SELECT civicrm_mailing_event_queue.id FROM civicrm_domain,civicrm_contact,civicrm_mailing_event_queue WHERE civicrm_mailing_event_queue.contact_id = civicrm_contact.id AND civicrm_contact.domain_id = civicrm_domain.id AND civicrm_domain.id = 1 UNION SELECT civicrm_mailing_event_queue.id FROM civicrm_domain,civicrm_mailing_component,civicrm_mailing,civicrm_mailing_job,civicrm_mailing_event_queue WHERE civicrm_mailing_event_queue.job_id = civicrm_mailing_job.id AND civicrm_mailing_job.mailing_id = civicrm_mailing.id AND civicrm_mailing.header_id = civicrm_mailing_component.id AND civicrm_mailing_component.domain_id = civicrm_domain.id AND civicrm_domain.id = 1 UNION SELECT civicrm_mailing_event_queue.id FROM civicrm_domain,civicrm_mailing,civicrm_mailing_job,civicrm_mailing_event_queue WHERE civicrm_mailing_event_queue.job_id = civicrm_mailing_job.id AND civicrm_mailing_job.mailing_id = civicrm_mailing.id AND civicrm_mailing.domain_id = civicrm_domain.id AND civicrm_domain.id = 1
civicrm_mailing_event_bounce|SELECT civicrm_mailing_event_bounce.id FROM civicrm_domain,civicrm_location_type,civicrm_location,civicrm_email,civicrm_mailing_event_queue,civicrm_mailing_event_bounce WHERE civicrm_mailing_event_bounce.event_queue_id = civicrm_mailing_event_queue.id AND civicrm_mailing_event_queue.email_id = civicrm_email.id AND civicrm_email.location_id = civicrm_location.id AND civicrm_location.location_type_id = civicrm_location_type.id AND civicrm_location_type.domain_id = civicrm_domain.id AND civicrm_domain.id = 1 UNION SELECT civicrm_mailing_event_bounce.id FROM civicrm_domain,civicrm_contact,civicrm_mailing_event_queue,civicrm_mailing_event_bounce WHERE civicrm_mailing_event_bounce.event_queue_id = civicrm_mailing_event_queue.id AND civicrm_mailing_event_queue.contact_id = civicrm_contact.id AND civicrm_contact.domain_id = civicrm_domain.id AND civicrm_domain.id = 1 UNION SELECT civicrm_mailing_event_bounce.id FROM civicrm_domain,civicrm_mailing_component,civicrm_mailing,civicrm_mailing_job,civicrm_mailing_event_queue,civicrm_mailing_event_bounce WHERE civicrm_mailing_event_bounce.event_queue_id = civicrm_mailing_event_queue.id AND civicrm_mailing_event_queue.job_id = civicrm_mailing_job.id AND civicrm_mailing_job.mailing_id = civicrm_mailing.id AND civicrm_mailing.header_id = civicrm_mailing_component.id AND civicrm_mailing_component.domain_id = civicrm_domain.id AND civicrm_domain.id = 1 UNION SELECT civicrm_mailing_event_bounce.id FROM civicrm_domain,civicrm_mailing,civicrm_mailing_job,civicrm_mailing_event_queue,civicrm_mailing_event_bounce WHERE civicrm_mailing_event_bounce.event_queue_id = civicrm_mailing_event_queue.id AND civicrm_mailing_event_queue.job_id = civicrm_mailing_job.id AND civicrm_mailing_job.mailing_id = civicrm_mailing.id AND civicrm_mailing.domain_id = civicrm_domain.id AND civicrm_domain.id = 1
civicrm_mailing_event_delivered|SELECT civicrm_mailing_event_delivered.id FROM civicrm_domain,civicrm_location_type,civicrm_location,civicrm_email,civicrm_mailing_event_queue,civicrm_mailing_event_delivered WHERE civicrm_mailing_event_delivered.event_queue_id = civicrm_mailing_event_queue.id AND civicrm_mailing_event_queue.email_id = civicrm_email.id AND civicrm_email.location_id = civicrm_location.id AND civicrm_location.location_type_id = civicrm_location_type.id AND civicrm_location_type.domain_id = civicrm_domain.id AND civicrm_domain.id = 1 UNION SELECT civicrm_mailing_event_delivered.id FROM civicrm_domain,civicrm_contact,civicrm_mailing_event_queue,civicrm_mailing_event_delivered WHERE civicrm_mailing_event_delivered.event_queue_id = civicrm_mailing_event_queue.id AND civicrm_mailing_event_queue.contact_id = civicrm_contact.id AND civicrm_contact.domain_id = civicrm_domain.id AND civicrm_domain.id = 1 UNION SELECT civicrm_mailing_event_delivered.id FROM civicrm_domain,civicrm_mailing_component,civicrm_mailing,civicrm_mailing_job,civicrm_mailing_event_queue,civicrm_mailing_event_delivered WHERE civicrm_mailing_event_delivered.event_queue_id = civicrm_mailing_event_queue.id AND civicrm_mailing_event_queue.job_id = civicrm_mailing_job.id AND civicrm_mailing_job.mailing_id = civicrm_mailing.id AND civicrm_mailing.header_id = civicrm_mailing_component.id AND civicrm_mailing_component.domain_id = civicrm_domain.id AND civicrm_domain.id = 1 UNION SELECT civicrm_mailing_event_delivered.id FROM civicrm_domain,civicrm_mailing,civicrm_mailing_job,civicrm_mailing_event_queue,civicrm_mailing_event_delivered WHERE civicrm_mailing_event_delivered.event_queue_id = civicrm_mailing_event_queue.id AND civicrm_mailing_event_queue.job_id = civicrm_mailing_job.id AND civicrm_mailing_job.mailing_id = civicrm_mailing.id AND civicrm_mailing.domain_id = civicrm_domain.id AND civicrm_domain.id = 1
civicrm_mailing_event_forward|SELECT civicrm_mailing_event_forward.id FROM civicrm_domain,civicrm_location_type,civicrm_location,civicrm_email,civicrm_mailing_event_queue,civicrm_mailing_event_forward WHERE civicrm_mailing_event_forward.event_queue_id = civicrm_mailing_event_queue.id AND civicrm_mailing_event_queue.email_id = civicrm_email.id AND civicrm_email.location_id = civicrm_location.id AND civicrm_location.location_type_id = civicrm_location_type.id AND civicrm_location_type.domain_id = civicrm_domain.id AND civicrm_domain.id = 1 UNION SELECT civicrm_mailing_event_forward.id FROM civicrm_domain,civicrm_contact,civicrm_mailing_event_queue,civicrm_mailing_event_forward WHERE civicrm_mailing_event_forward.event_queue_id = civicrm_mailing_event_queue.id AND civicrm_mailing_event_queue.contact_id = civicrm_contact.id AND civicrm_contact.domain_id = civicrm_domain.id AND civicrm_domain.id = 1 UNION SELECT civicrm_mailing_event_forward.id FROM civicrm_domain,civicrm_mailing_component,civicrm_mailing,civicrm_mailing_job,civicrm_mailing_event_queue,civicrm_mailing_event_forward WHERE civicrm_mailing_event_forward.event_queue_id = civicrm_mailing_event_queue.id AND civicrm_mailing_event_queue.job_id = civicrm_mailing_job.id AND civicrm_mailing_job.mailing_id = civicrm_mailing.id AND civicrm_mailing.header_id = civicrm_mailing_component.id AND civicrm_mailing_component.domain_id = civicrm_domain.id AND civicrm_domain.id = 1 UNION SELECT civicrm_mailing_event_forward.id FROM civicrm_domain,civicrm_mailing,civicrm_mailing_job,civicrm_mailing_event_queue,civicrm_mailing_event_forward WHERE civicrm_mailing_event_forward.event_queue_id = civicrm_mailing_event_queue.id AND civicrm_mailing_event_queue.job_id = civicrm_mailing_job.id AND civicrm_mailing_job.mailing_id = civicrm_mailing.id AND civicrm_mailing.domain_id = civicrm_domain.id AND civicrm_domain.id = 1
civicrm_mailing_event_opened|SELECT civicrm_mailing_event_opened.id FROM civicrm_domain,civicrm_location_type,civicrm_location,civicrm_email,civicrm_mailing_event_queue,civicrm_mailing_event_opened WHERE civicrm_mailing_event_opened.event_queue_id = civicrm_mailing_event_queue.id AND civicrm_mailing_event_queue.email_id = civicrm_email.id AND civicrm_email.location_id = civicrm_location.id AND civicrm_location.location_type_id = civicrm_location_type.id AND civicrm_location_type.domain_id = civicrm_domain.id AND civicrm_domain.id = 1 UNION SELECT civicrm_mailing_event_opened.id FROM civicrm_domain,civicrm_contact,civicrm_mailing_event_queue,civicrm_mailing_event_opened WHERE civicrm_mailing_event_opened.event_queue_id = civicrm_mailing_event_queue.id AND civicrm_mailing_event_queue.contact_id = civicrm_contact.id AND civicrm_contact.domain_id = civicrm_domain.id AND civicrm_domain.id = 1 UNION SELECT civicrm_mailing_event_opened.id FROM civicrm_domain,civicrm_mailing_component,civicrm_mailing,civicrm_mailing_job,civicrm_mailing_event_queue,civicrm_mailing_event_opened WHERE civicrm_mailing_event_opened.event_queue_id = civicrm_mailing_event_queue.id AND civicrm_mailing_event_queue.job_id = civicrm_mailing_job.id AND civicrm_mailing_job.mailing_id = civicrm_mailing.id AND civicrm_mailing.header_id = civicrm_mailing_component.id AND civicrm_mailing_component.domain_id = civicrm_domain.id AND civicrm_domain.id = 1 UNION SELECT civicrm_mailing_event_opened.id FROM civicrm_domain,civicrm_mailing,civicrm_mailing_job,civicrm_mailing_event_queue,civicrm_mailing_event_opened WHERE civicrm_mailing_event_opened.event_queue_id = civicrm_mailing_event_queue.id AND civicrm_mailing_event_queue.job_id = civicrm_mailing_job.id AND civicrm_mailing_job.mailing_id = civicrm_mailing.id AND civicrm_mailing.domain_id = civicrm_domain.id AND civicrm_domain.id = 1
civicrm_mailing_event_reply|SELECT civicrm_mailing_event_reply.id FROM civicrm_domain,civicrm_location_type,civicrm_location,civicrm_email,civicrm_mailing_event_queue,civicrm_mailing_event_reply WHERE civicrm_mailing_event_reply.event_queue_id = civicrm_mailing_event_queue.id AND civicrm_mailing_event_queue.email_id = civicrm_email.id AND civicrm_email.location_id = civicrm_location.id AND civicrm_location.location_type_id = civicrm_location_type.id AND civicrm_location_type.domain_id = civicrm_domain.id AND civicrm_domain.id = 1 UNION SELECT civicrm_mailing_event_reply.id FROM civicrm_domain,civicrm_contact,civicrm_mailing_event_queue,civicrm_mailing_event_reply WHERE civicrm_mailing_event_reply.event_queue_id = civicrm_mailing_event_queue.id AND civicrm_mailing_event_queue.contact_id = civicrm_contact.id AND civicrm_contact.domain_id = civicrm_domain.id AND civicrm_domain.id = 1 UNION SELECT civicrm_mailing_event_reply.id FROM civicrm_domain,civicrm_mailing_component,civicrm_mailing,civicrm_mailing_job,civicrm_mailing_event_queue,civicrm_mailing_event_reply WHERE civicrm_mailing_event_reply.event_queue_id = civicrm_mailing_event_queue.id AND civicrm_mailing_event_queue.job_id = civicrm_mailing_job.id AND civicrm_mailing_job.mailing_id = civicrm_mailing.id AND civicrm_mailing.header_id = civicrm_mailing_component.id AND civicrm_mailing_component.domain_id = civicrm_domain.id AND civicrm_domain.id = 1 UNION SELECT civicrm_mailing_event_reply.id FROM civicrm_domain,civicrm_mailing,civicrm_mailing_job,civicrm_mailing_event_queue,civicrm_mailing_event_reply WHERE civicrm_mailing_event_reply.event_queue_id = civicrm_mailing_event_queue.id AND civicrm_mailing_event_queue.job_id = civicrm_mailing_job.id AND civicrm_mailing_job.mailing_id = civicrm_mailing.id AND civicrm_mailing.domain_id = civicrm_domain.id AND civicrm_domain.id = 1
civicrm_mailing_event_trackable_url_open|SELECT civicrm_mailing_event_trackable_url_open.id FROM civicrm_domain,civicrm_location_type,civicrm_location,civicrm_email,civicrm_mailing_event_queue,civicrm_mailing_event_trackable_url_open WHERE civicrm_mailing_event_trackable_url_open.event_queue_id = civicrm_mailing_event_queue.id AND civicrm_mailing_event_queue.email_id = civicrm_email.id AND civicrm_email.location_id = civicrm_location.id AND civicrm_location.location_type_id = civicrm_location_type.id AND civicrm_location_type.domain_id = civicrm_domain.id AND civicrm_domain.id = 1 UNION SELECT civicrm_mailing_event_trackable_url_open.id FROM civicrm_domain,civicrm_contact,civicrm_mailing_event_queue,civicrm_mailing_event_trackable_url_open WHERE civicrm_mailing_event_trackable_url_open.event_queue_id = civicrm_mailing_event_queue.id AND civicrm_mailing_event_queue.contact_id = civicrm_contact.id AND civicrm_contact.domain_id = civicrm_domain.id AND civicrm_domain.id = 1 UNION SELECT civicrm_mailing_event_trackable_url_open.id FROM civicrm_domain,civicrm_mailing_component,civicrm_mailing,civicrm_mailing_trackable_url,civicrm_mailing_event_trackable_url_open WHERE civicrm_mailing_event_trackable_url_open.trackable_url_id = civicrm_mailing_trackable_url.id AND civicrm_mailing_trackable_url.mailing_id = civicrm_mailing.id AND civicrm_mailing.header_id = civicrm_mailing_component.id AND civicrm_mailing_component.domain_id = civicrm_domain.id AND civicrm_domain.id = 1 UNION SELECT civicrm_mailing_event_trackable_url_open.id FROM civicrm_domain,civicrm_mailing_component,civicrm_mailing,civicrm_mailing_job,civicrm_mailing_event_queue,civicrm_mailing_event_trackable_url_open WHERE civicrm_mailing_event_trackable_url_open.event_queue_id = civicrm_mailing_event_queue.id AND civicrm_mailing_event_queue.job_id = civicrm_mailing_job.id AND civicrm_mailing_job.mailing_id = civicrm_mailing.id AND civicrm_mailing.header_id = civicrm_mailing_component.id AND civicrm_mailing_component.domain_id = civicrm_domain.id AND civicrm_domain.id = 1 UNION SELECT civicrm_mailing_event_trackable_url_open.id FROM civicrm_domain,civicrm_mailing,civicrm_mailing_trackable_url,civicrm_mailing_event_trackable_url_open WHERE civicrm_mailing_event_trackable_url_open.trackable_url_id = civicrm_mailing_trackable_url.id AND civicrm_mailing_trackable_url.mailing_id = civicrm_mailing.id AND civicrm_mailing.domain_id = civicrm_domain.id AND civicrm_domain.id = 1 UNION SELECT civicrm_mailing_event_trackable_url_open.id FROM civicrm_domain,civicrm_mailing,civicrm_mailing_job,civicrm_mailing_event_queue,civicrm_mailing_event_trackable_url_open WHERE civicrm_mailing_event_trackable_url_open.event_queue_id = civicrm_mailing_event_queue.id AND civicrm_mailing_event_queue.job_id = civicrm_mailing_job.id AND civicrm_mailing_job.mailing_id = civicrm_mailing.id AND civicrm_mailing.domain_id = civicrm_domain.id AND civicrm_domain.id = 1
civicrm_mailing_event_unsubscribe|SELECT civicrm_mailing_event_unsubscribe.id FROM civicrm_domain,civicrm_location_type,civicrm_location,civicrm_email,civicrm_mailing_event_queue,civicrm_mailing_event_unsubscribe WHERE civicrm_mailing_event_unsubscribe.event_queue_id = civicrm_mailing_event_queue.id AND civicrm_mailing_event_queue.email_id = civicrm_email.id AND civicrm_email.location_id = civicrm_location.id AND civicrm_location.location_type_id = civicrm_location_type.id AND civicrm_location_type.domain_id = civicrm_domain.id AND civicrm_domain.id = 1 UNION SELECT civicrm_mailing_event_unsubscribe.id FROM civicrm_domain,civicrm_contact,civicrm_mailing_event_queue,civicrm_mailing_event_unsubscribe WHERE civicrm_mailing_event_unsubscribe.event_queue_id = civicrm_mailing_event_queue.id AND civicrm_mailing_event_queue.contact_id = civicrm_contact.id AND civicrm_contact.domain_id = civicrm_domain.id AND civicrm_domain.id = 1 UNION SELECT civicrm_mailing_event_unsubscribe.id FROM civicrm_domain,civicrm_mailing_component,civicrm_mailing,civicrm_mailing_job,civicrm_mailing_event_queue,civicrm_mailing_event_unsubscribe WHERE civicrm_mailing_event_unsubscribe.event_queue_id = civicrm_mailing_event_queue.id AND civicrm_mailing_event_queue.job_id = civicrm_mailing_job.id AND civicrm_mailing_job.mailing_id = civicrm_mailing.id AND civicrm_mailing.header_id = civicrm_mailing_component.id AND civicrm_mailing_component.domain_id = civicrm_domain.id AND civicrm_domain.id = 1 UNION SELECT civicrm_mailing_event_unsubscribe.id FROM civicrm_domain,civicrm_mailing,civicrm_mailing_job,civicrm_mailing_event_queue,civicrm_mailing_event_unsubscribe WHERE civicrm_mailing_event_unsubscribe.event_queue_id = civicrm_mailing_event_queue.id AND civicrm_mailing_event_queue.job_id = civicrm_mailing_job.id AND civicrm_mailing_job.mailing_id = civicrm_mailing.id AND civicrm_mailing.domain_id = civicrm_domain.id AND civicrm_domain.id = 1
civicrm_im|SELECT civicrm_im.id FROM civicrm_domain,civicrm_location_type,civicrm_location,civicrm_im WHERE civicrm_im.location_id = civicrm_location.id AND civicrm_location.location_type_id = civicrm_location_type.id AND civicrm_location_type.domain_id = civicrm_domain.id AND civicrm_domain.id = 1
civicrm_mapping_field|SELECT civicrm_mapping_field.id FROM civicrm_domain,civicrm_location_type,civicrm_mapping_field WHERE civicrm_mapping_field.location_type_id = civicrm_location_type.id AND civicrm_location_type.domain_id = civicrm_domain.id AND civicrm_domain.id = 1 UNION SELECT civicrm_mapping_field.id FROM civicrm_domain,civicrm_mapping,civicrm_mapping_field WHERE civicrm_mapping_field.mapping_id = civicrm_mapping.id AND civicrm_mapping.domain_id = civicrm_domain.id AND civicrm_domain.id = 1 UNION SELECT civicrm_mapping_field.id FROM civicrm_domain,civicrm_relationship_type,civicrm_mapping_field WHERE civicrm_mapping_field.relationship_type_id = civicrm_relationship_type.id AND civicrm_relationship_type.domain_id = civicrm_domain.id AND civicrm_domain.id = 1
civicrm_uf_field|SELECT civicrm_uf_field.id FROM civicrm_domain,civicrm_location_type,civicrm_uf_field WHERE civicrm_uf_field.location_type_id = civicrm_location_type.id AND civicrm_location_type.domain_id = civicrm_domain.id AND civicrm_domain.id = 1 UNION SELECT civicrm_uf_field.id FROM civicrm_domain,civicrm_mapping,civicrm_saved_search,civicrm_group,civicrm_uf_group,civicrm_uf_field WHERE civicrm_uf_field.uf_group_id = civicrm_uf_group.id AND civicrm_uf_group.limit_listings_group_id = civicrm_group.id AND civicrm_group.saved_search_id = civicrm_saved_search.id AND civicrm_saved_search.mapping_id = civicrm_mapping.id AND civicrm_mapping.domain_id = civicrm_domain.id AND civicrm_domain.id = 1 UNION SELECT civicrm_uf_field.id FROM civicrm_domain,civicrm_group,civicrm_uf_group,civicrm_uf_field WHERE civicrm_uf_field.uf_group_id = civicrm_uf_group.id AND civicrm_uf_group.limit_listings_group_id = civicrm_group.id AND civicrm_group.domain_id = civicrm_domain.id AND civicrm_domain.id = 1 UNION SELECT civicrm_uf_field.id FROM civicrm_domain,civicrm_uf_group,civicrm_uf_field WHERE civicrm_uf_field.uf_group_id = civicrm_uf_group.id AND civicrm_uf_group.domain_id = civicrm_domain.id AND civicrm_domain.id = 1
civicrm_mapping|SELECT civicrm_mapping.id FROM civicrm_domain,civicrm_mapping WHERE civicrm_mapping.domain_id = civicrm_domain.id AND civicrm_domain.id = 1
civicrm_saved_search|SELECT civicrm_saved_search.id FROM civicrm_domain,civicrm_mapping,civicrm_saved_search WHERE civicrm_saved_search.mapping_id = civicrm_mapping.id AND civicrm_mapping.domain_id = civicrm_domain.id AND civicrm_domain.id = 1
civicrm_group|SELECT civicrm_group.id FROM civicrm_domain,civicrm_mapping,civicrm_saved_search,civicrm_group WHERE civicrm_group.saved_search_id = civicrm_saved_search.id AND civicrm_saved_search.mapping_id = civicrm_mapping.id AND civicrm_mapping.domain_id = civicrm_domain.id AND civicrm_domain.id = 1 UNION SELECT civicrm_group.id FROM civicrm_domain,civicrm_group WHERE civicrm_group.domain_id = civicrm_domain.id AND civicrm_domain.id = 1
civicrm_subscription_history|SELECT civicrm_subscription_history.id FROM civicrm_domain,civicrm_mapping,civicrm_saved_search,civicrm_group,civicrm_subscription_history WHERE civicrm_subscription_history.group_id = civicrm_group.id AND civicrm_group.saved_search_id = civicrm_saved_search.id AND civicrm_saved_search.mapping_id = civicrm_mapping.id AND civicrm_mapping.domain_id = civicrm_domain.id AND civicrm_domain.id = 1 UNION SELECT civicrm_subscription_history.id FROM civicrm_domain,civicrm_contact,civicrm_subscription_history WHERE civicrm_subscription_history.contact_id = civicrm_contact.id AND civicrm_contact.domain_id = civicrm_domain.id AND civicrm_domain.id = 1 UNION SELECT civicrm_subscription_history.id FROM civicrm_domain,civicrm_group,civicrm_subscription_history WHERE civicrm_subscription_history.group_id = civicrm_group.id AND civicrm_group.domain_id = civicrm_domain.id AND civicrm_domain.id = 1
civicrm_mailing_event_subscribe|SELECT civicrm_mailing_event_subscribe.id FROM civicrm_domain,civicrm_mapping,civicrm_saved_search,civicrm_group,civicrm_mailing_event_subscribe WHERE civicrm_mailing_event_subscribe.group_id = civicrm_group.id AND civicrm_group.saved_search_id = civicrm_saved_search.id AND civicrm_saved_search.mapping_id = civicrm_mapping.id AND civicrm_mapping.domain_id = civicrm_domain.id AND civicrm_domain.id = 1 UNION SELECT civicrm_mailing_event_subscribe.id FROM civicrm_domain,civicrm_contact,civicrm_mailing_event_subscribe WHERE civicrm_mailing_event_subscribe.contact_id = civicrm_contact.id AND civicrm_contact.domain_id = civicrm_domain.id AND civicrm_domain.id = 1 UNION SELECT civicrm_mailing_event_subscribe.id FROM civicrm_domain,civicrm_group,civicrm_mailing_event_subscribe WHERE civicrm_mailing_event_subscribe.group_id = civicrm_group.id AND civicrm_group.domain_id = civicrm_domain.id AND civicrm_domain.id = 1
civicrm_mailing_event_confirm|SELECT civicrm_mailing_event_confirm.id FROM civicrm_domain,civicrm_mapping,civicrm_saved_search,civicrm_group,civicrm_mailing_event_subscribe,civicrm_mailing_event_confirm WHERE civicrm_mailing_event_confirm.event_subscribe_id = civicrm_mailing_event_subscribe.id AND civicrm_mailing_event_subscribe.group_id = civicrm_group.id AND civicrm_group.saved_search_id = civicrm_saved_search.id AND civicrm_saved_search.mapping_id = civicrm_mapping.id AND civicrm_mapping.domain_id = civicrm_domain.id AND civicrm_domain.id = 1 UNION SELECT civicrm_mailing_event_confirm.id FROM civicrm_domain,civicrm_contact,civicrm_mailing_event_subscribe,civicrm_mailing_event_confirm WHERE civicrm_mailing_event_confirm.event_subscribe_id = civicrm_mailing_event_subscribe.id AND civicrm_mailing_event_subscribe.contact_id = civicrm_contact.id AND civicrm_contact.domain_id = civicrm_domain.id AND civicrm_domain.id = 1 UNION SELECT civicrm_mailing_event_confirm.id FROM civicrm_domain,civicrm_group,civicrm_mailing_event_subscribe,civicrm_mailing_event_confirm WHERE civicrm_mailing_event_confirm.event_subscribe_id = civicrm_mailing_event_subscribe.id AND civicrm_mailing_event_subscribe.group_id = civicrm_group.id AND civicrm_group.domain_id = civicrm_domain.id AND civicrm_domain.id = 1
civicrm_activity_history|SELECT civicrm_activity_history.id FROM  civicrm_domain, civicrm_contact, civicrm_activity_history WHERE civicrm_activity_history.entity_id = civicrm_contact.id AND civicrm_contact.domain_id = civicrm_domain.id AND civicrm_domain.id = 1  UNION SELECT civicrm_activity_history.id FROM  civicrm_domain, civicrm_contact, civicrm_activity_history WHERE civicrm_activity_history.entity_id = civicrm_contact.id AND civicrm_contact.domain_id = civicrm_domain.id AND civicrm_domain.id = 1  UNION SELECT civicrm_activity_history.id FROM  civicrm_domain, civicrm_contact, civicrm_activity_history WHERE civicrm_activity_history.entity_id = civicrm_contact.id AND civicrm_contact.domain_id = civicrm_domain.id AND civicrm_domain.id = 1  UNION SELECT civicrm_activity_history.id FROM  civicrm_domain, civicrm_contact, civicrm_activity_history WHERE civicrm_activity_history.entity_id = civicrm_contact.id AND civicrm_contact.domain_id = civicrm_domain.id AND civicrm_domain.id = 1 
civicrm_uf_group|SELECT civicrm_uf_group.id FROM civicrm_domain,civicrm_mapping,civicrm_saved_search,civicrm_group,civicrm_uf_group WHERE civicrm_uf_group.limit_listings_group_id = civicrm_group.id AND civicrm_group.saved_search_id = civicrm_saved_search.id AND civicrm_saved_search.mapping_id = civicrm_mapping.id AND civicrm_mapping.domain_id = civicrm_domain.id AND civicrm_domain.id = 1 UNION SELECT civicrm_uf_group.id FROM civicrm_domain,civicrm_group,civicrm_uf_group WHERE civicrm_uf_group.limit_listings_group_id = civicrm_group.id AND civicrm_group.domain_id = civicrm_domain.id AND civicrm_domain.id = 1 UNION SELECT civicrm_uf_group.id FROM civicrm_domain,civicrm_uf_group WHERE civicrm_uf_group.domain_id = civicrm_domain.id AND civicrm_domain.id = 1
civicrm_uf_join|SELECT civicrm_uf_join.id FROM civicrm_domain,civicrm_mapping,civicrm_saved_search,civicrm_group,civicrm_uf_group,civicrm_uf_join WHERE civicrm_uf_join.uf_group_id = civicrm_uf_group.id AND civicrm_uf_group.limit_listings_group_id = civicrm_group.id AND civicrm_group.saved_search_id = civicrm_saved_search.id AND civicrm_saved_search.mapping_id = civicrm_mapping.id AND civicrm_mapping.domain_id = civicrm_domain.id AND civicrm_domain.id = 1 UNION SELECT civicrm_uf_join.id FROM civicrm_domain,civicrm_group,civicrm_uf_group,civicrm_uf_join WHERE civicrm_uf_join.uf_group_id = civicrm_uf_group.id AND civicrm_uf_group.limit_listings_group_id = civicrm_group.id AND civicrm_group.domain_id = civicrm_domain.id AND civicrm_domain.id = 1 UNION SELECT civicrm_uf_join.id FROM civicrm_domain,civicrm_uf_group,civicrm_uf_join WHERE civicrm_uf_join.uf_group_id = civicrm_uf_group.id AND civicrm_uf_group.domain_id = civicrm_domain.id AND civicrm_domain.id = 1
civicrm_tag|SELECT civicrm_tag.id FROM civicrm_domain,civicrm_tag WHERE civicrm_tag.domain_id = civicrm_domain.id AND civicrm_domain.id = 1
civicrm_entity_tag|SELECT civicrm_entity_tag.id FROM civicrm_domain,civicrm_tag,civicrm_entity_tag WHERE civicrm_entity_tag.tag_id = civicrm_tag.id AND civicrm_tag.domain_id = civicrm_domain.id AND civicrm_domain.id = 1
civicrm_validation|SELECT civicrm_validation.id FROM civicrm_domain,civicrm_validation WHERE civicrm_validation.domain_id = civicrm_domain.id AND civicrm_domain.id = 1
civicrm_custom_field|SELECT civicrm_custom_field.id FROM civicrm_domain,civicrm_validation,civicrm_custom_field WHERE civicrm_custom_field.validation_id = civicrm_validation.id AND civicrm_validation.domain_id = civicrm_domain.id AND civicrm_domain.id = 1 UNION SELECT civicrm_custom_field.id FROM civicrm_domain,civicrm_custom_group,civicrm_custom_field WHERE civicrm_custom_field.custom_group_id = civicrm_custom_group.id AND civicrm_custom_group.domain_id = civicrm_domain.id AND civicrm_domain.id = 1
civicrm_custom_value|SELECT civicrm_custom_value.id FROM civicrm_domain,civicrm_validation,civicrm_custom_field,civicrm_custom_value WHERE civicrm_custom_value.custom_field_id = civicrm_custom_field.id AND civicrm_custom_field.validation_id = civicrm_validation.id AND civicrm_validation.domain_id = civicrm_domain.id AND civicrm_domain.id = 1 UNION SELECT civicrm_custom_value.id FROM civicrm_domain,civicrm_custom_group,civicrm_custom_field,civicrm_custom_value WHERE civicrm_custom_value.custom_field_id = civicrm_custom_field.id AND civicrm_custom_field.custom_group_id = civicrm_custom_group.id AND civicrm_custom_group.domain_id = civicrm_domain.id AND civicrm_domain.id = 1
civicrm_dupe_match|SELECT civicrm_dupe_match.id FROM civicrm_domain,civicrm_dupe_match WHERE civicrm_dupe_match.domain_id = civicrm_domain.id AND civicrm_domain.id = 1
civicrm_option_group|SELECT civicrm_option_group.id FROM civicrm_domain,civicrm_option_group WHERE civicrm_option_group.domain_id = civicrm_domain.id AND civicrm_domain.id = 1
civicrm_option_value|SELECT civicrm_option_value.id FROM civicrm_domain,civicrm_option_group,civicrm_option_value WHERE civicrm_option_value.option_group_id = civicrm_option_group.id AND civicrm_option_group.domain_id = civicrm_domain.id AND civicrm_domain.id = 1
civicrm_acl|SELECT civicrm_acl.id FROM civicrm_domain,civicrm_acl WHERE civicrm_acl.domain_id = civicrm_domain.id AND civicrm_domain.id = 1
civicrm_acl_cache|SELECT civicrm_acl_cache.id FROM civicrm_domain,civicrm_acl,civicrm_acl_cache WHERE civicrm_acl_cache.acl_id = civicrm_acl.id AND civicrm_acl.domain_id = civicrm_domain.id AND civicrm_domain.id = 1 UNION SELECT civicrm_acl_cache.id FROM civicrm_domain,civicrm_contact,civicrm_acl_cache WHERE civicrm_acl_cache.contact_id = civicrm_contact.id AND civicrm_contact.domain_id = civicrm_domain.id AND civicrm_domain.id = 1
civicrm_acl_entity_role|SELECT civicrm_acl_entity_role.id FROM civicrm_domain,civicrm_acl_entity_role WHERE civicrm_acl_entity_role.domain_id = civicrm_domain.id AND civicrm_domain.id = 1
civicrm_contact|SELECT civicrm_contact.id FROM civicrm_domain,civicrm_contact WHERE civicrm_contact.domain_id = civicrm_domain.id AND civicrm_domain.id = 1
civicrm_household|SELECT civicrm_household.id FROM civicrm_domain,civicrm_contact,civicrm_household WHERE civicrm_household.contact_id = civicrm_contact.id AND civicrm_contact.domain_id = civicrm_domain.id AND civicrm_domain.id = 1
civicrm_individual|SELECT civicrm_individual.id FROM civicrm_domain,civicrm_contact,civicrm_individual WHERE civicrm_individual.contact_id = civicrm_contact.id AND civicrm_contact.domain_id = civicrm_domain.id AND civicrm_domain.id = 1
civicrm_organization|SELECT civicrm_organization.id FROM civicrm_domain,civicrm_contact,civicrm_organization WHERE civicrm_organization.contact_id = civicrm_contact.id AND civicrm_contact.domain_id = civicrm_domain.id AND civicrm_domain.id = 1
civicrm_contribution_recur|SELECT civicrm_contribution_recur.id FROM civicrm_domain,civicrm_contact,civicrm_contribution_recur WHERE civicrm_contribution_recur.contact_id = civicrm_contact.id AND civicrm_contact.domain_id = civicrm_domain.id AND civicrm_domain.id = 1 UNION SELECT civicrm_contribution_recur.id FROM civicrm_domain,civicrm_contribution_recur WHERE civicrm_contribution_recur.domain_id = civicrm_domain.id AND civicrm_domain.id = 1
civicrm_contribution|SELECT civicrm_contribution.id FROM civicrm_domain,civicrm_contact,civicrm_contribution_recur,civicrm_contribution WHERE civicrm_contribution.contribution_recur_id = civicrm_contribution_recur.id AND civicrm_contribution_recur.contact_id = civicrm_contact.id AND civicrm_contact.domain_id = civicrm_domain.id AND civicrm_domain.id = 1 UNION SELECT civicrm_contribution.id FROM civicrm_domain,civicrm_contact,civicrm_contribution WHERE civicrm_contribution.contact_id = civicrm_contact.id AND civicrm_contact.domain_id = civicrm_domain.id AND civicrm_domain.id = 1 UNION SELECT civicrm_contribution.id FROM civicrm_domain,civicrm_contribution_recur,civicrm_contribution WHERE civicrm_contribution.contribution_recur_id = civicrm_contribution_recur.id AND civicrm_contribution_recur.domain_id = civicrm_domain.id AND civicrm_domain.id = 1 UNION SELECT civicrm_contribution.id FROM civicrm_domain,civicrm_contribution_type,civicrm_contribution_page,civicrm_contribution WHERE civicrm_contribution.contribution_page_id = civicrm_contribution_page.id AND civicrm_contribution_page.contribution_type_id = civicrm_contribution_type.id AND civicrm_contribution_type.domain_id = civicrm_domain.id AND civicrm_domain.id = 1 UNION SELECT civicrm_contribution.id FROM civicrm_domain,civicrm_contribution_type,civicrm_contribution WHERE civicrm_contribution.contribution_type_id = civicrm_contribution_type.id AND civicrm_contribution_type.domain_id = civicrm_domain.id AND civicrm_domain.id = 1 UNION SELECT civicrm_contribution.id FROM civicrm_domain,civicrm_contribution_page,civicrm_contribution WHERE civicrm_contribution.contribution_page_id = civicrm_contribution_page.id AND civicrm_contribution_page.domain_id = civicrm_domain.id AND civicrm_domain.id = 1 UNION SELECT civicrm_contribution.id FROM civicrm_domain,civicrm_contribution WHERE civicrm_contribution.domain_id = civicrm_domain.id AND civicrm_domain.id = 1
civicrm_contribution_product|SELECT civicrm_contribution_product.id FROM civicrm_domain,civicrm_contact,civicrm_contribution_recur,civicrm_contribution,civicrm_contribution_product WHERE civicrm_contribution_product.contribution_id = civicrm_contribution.id AND civicrm_contribution.contribution_recur_id = civicrm_contribution_recur.id AND civicrm_contribution_recur.contact_id = civicrm_contact.id AND civicrm_contact.domain_id = civicrm_domain.id AND civicrm_domain.id = 1 UNION SELECT civicrm_contribution_product.id FROM civicrm_domain,civicrm_contact,civicrm_contribution,civicrm_contribution_product WHERE civicrm_contribution_product.contribution_id = civicrm_contribution.id AND civicrm_contribution.contact_id = civicrm_contact.id AND civicrm_contact.domain_id = civicrm_domain.id AND civicrm_domain.id = 1 UNION SELECT civicrm_contribution_product.id FROM civicrm_domain,civicrm_contribution_recur,civicrm_contribution,civicrm_contribution_product WHERE civicrm_contribution_product.contribution_id = civicrm_contribution.id AND civicrm_contribution.contribution_recur_id = civicrm_contribution_recur.id AND civicrm_contribution_recur.domain_id = civicrm_domain.id AND civicrm_domain.id = 1 UNION SELECT civicrm_contribution_product.id FROM civicrm_domain,civicrm_contribution_type,civicrm_contribution_page,civicrm_contribution,civicrm_contribution_product WHERE civicrm_contribution_product.contribution_id = civicrm_contribution.id AND civicrm_contribution.contribution_page_id = civicrm_contribution_page.id AND civicrm_contribution_page.contribution_type_id = civicrm_contribution_type.id AND civicrm_contribution_type.domain_id = civicrm_domain.id AND civicrm_domain.id = 1 UNION SELECT civicrm_contribution_product.id FROM civicrm_domain,civicrm_contribution_type,civicrm_contribution,civicrm_contribution_product WHERE civicrm_contribution_product.contribution_id = civicrm_contribution.id AND civicrm_contribution.contribution_type_id = civicrm_contribution_type.id AND civicrm_contribution_type.domain_id = civicrm_domain.id AND civicrm_domain.id = 1 UNION SELECT civicrm_contribution_product.id FROM civicrm_domain,civicrm_contribution_page,civicrm_contribution,civicrm_contribution_product WHERE civicrm_contribution_product.contribution_id = civicrm_contribution.id AND civicrm_contribution.contribution_page_id = civicrm_contribution_page.id AND civicrm_contribution_page.domain_id = civicrm_domain.id AND civicrm_domain.id = 1 UNION SELECT civicrm_contribution_product.id FROM civicrm_domain,civicrm_contribution,civicrm_contribution_product WHERE civicrm_contribution_product.contribution_id = civicrm_contribution.id AND civicrm_contribution.domain_id = civicrm_domain.id AND civicrm_domain.id = 1
civicrm_sms_history|SELECT civicrm_sms_history.id FROM civicrm_domain,civicrm_contact,civicrm_sms_history WHERE civicrm_sms_history.contact_id = civicrm_contact.id AND civicrm_contact.domain_id = civicrm_domain.id AND civicrm_domain.id = 1
civicrm_activity|SELECT civicrm_activity.id FROM civicrm_domain,civicrm_contact,civicrm_activity WHERE civicrm_activity.source_contact_id = civicrm_contact.id AND civicrm_contact.domain_id = civicrm_domain.id AND civicrm_domain.id = 1
civicrm_meeting|SELECT civicrm_meeting.id FROM civicrm_domain,civicrm_contact,civicrm_meeting WHERE civicrm_meeting.source_contact_id = civicrm_contact.id AND civicrm_contact.domain_id = civicrm_domain.id AND civicrm_domain.id = 1
civicrm_participant|SELECT civicrm_participant.id FROM civicrm_domain,civicrm_contact,civicrm_participant WHERE civicrm_participant.contact_id = civicrm_contact.id AND civicrm_contact.domain_id = civicrm_domain.id AND civicrm_domain.id = 1 UNION SELECT civicrm_participant.id FROM civicrm_domain,civicrm_event,civicrm_participant WHERE civicrm_participant.event_id = civicrm_event.id AND civicrm_event.domain_id = civicrm_domain.id AND civicrm_domain.id = 1
civicrm_participant_payment|SELECT civicrm_participant_payment.id FROM civicrm_domain,civicrm_contact,civicrm_participant,civicrm_participant_payment WHERE civicrm_participant_payment.participant_id = civicrm_participant.id AND civicrm_participant.contact_id = civicrm_contact.id AND civicrm_contact.domain_id = civicrm_domain.id AND civicrm_domain.id = 1 UNION SELECT civicrm_participant_payment.id FROM civicrm_domain,civicrm_event,civicrm_participant,civicrm_participant_payment WHERE civicrm_participant_payment.participant_id = civicrm_participant.id AND civicrm_participant.event_id = civicrm_event.id AND civicrm_event.domain_id = civicrm_domain.id AND civicrm_domain.id = 1
civicrm_email_history|SELECT civicrm_email_history.id FROM civicrm_domain,civicrm_contact,civicrm_email_history WHERE civicrm_email_history.contact_id = civicrm_contact.id AND civicrm_contact.domain_id = civicrm_domain.id AND civicrm_domain.id = 1
civicrm_note|SELECT civicrm_note.id FROM civicrm_domain,civicrm_contact,civicrm_note WHERE civicrm_note.contact_id = civicrm_contact.id AND civicrm_contact.domain_id = civicrm_domain.id AND civicrm_domain.id = 1
civicrm_uf_match|SELECT civicrm_uf_match.id FROM civicrm_domain,civicrm_contact,civicrm_uf_match WHERE civicrm_uf_match.contact_id = civicrm_contact.id AND civicrm_contact.domain_id = civicrm_domain.id AND civicrm_domain.id = 1 UNION SELECT civicrm_uf_match.id FROM civicrm_domain,civicrm_uf_match WHERE civicrm_uf_match.domain_id = civicrm_domain.id AND civicrm_domain.id = 1
civicrm_log|SELECT civicrm_log.id FROM civicrm_domain,civicrm_contact,civicrm_log WHERE civicrm_log.modified_id = civicrm_contact.id AND civicrm_contact.domain_id = civicrm_domain.id AND civicrm_domain.id = 1
civicrm_relationship|SELECT civicrm_relationship.id FROM civicrm_domain,civicrm_contact,civicrm_relationship WHERE civicrm_relationship.contact_id_a = civicrm_contact.id AND civicrm_contact.domain_id = civicrm_domain.id AND civicrm_domain.id = 1 UNION SELECT civicrm_relationship.id FROM civicrm_domain,civicrm_relationship_type,civicrm_relationship WHERE civicrm_relationship.relationship_type_id = civicrm_relationship_type.id AND civicrm_relationship_type.domain_id = civicrm_domain.id AND civicrm_domain.id = 1
civicrm_membership_type|SELECT civicrm_membership_type.id FROM civicrm_domain,civicrm_contact,civicrm_membership_type WHERE civicrm_membership_type.member_of_contact_id = civicrm_contact.id AND civicrm_contact.domain_id = civicrm_domain.id AND civicrm_domain.id = 1 UNION SELECT civicrm_membership_type.id FROM civicrm_domain,civicrm_relationship_type,civicrm_membership_type WHERE civicrm_membership_type.relationship_type_id = civicrm_relationship_type.id AND civicrm_relationship_type.domain_id = civicrm_domain.id AND civicrm_domain.id = 1 UNION SELECT civicrm_membership_type.id FROM civicrm_domain,civicrm_contribution_type,civicrm_membership_type WHERE civicrm_membership_type.contribution_type_id = civicrm_contribution_type.id AND civicrm_contribution_type.domain_id = civicrm_domain.id AND civicrm_domain.id = 1 UNION SELECT civicrm_membership_type.id FROM civicrm_domain,civicrm_msg_template,civicrm_membership_type WHERE civicrm_membership_type.renewal_msg_id = civicrm_msg_template.id AND civicrm_msg_template.domain_id = civicrm_domain.id AND civicrm_domain.id = 1 UNION SELECT civicrm_membership_type.id FROM civicrm_domain,civicrm_membership_type WHERE civicrm_membership_type.domain_id = civicrm_domain.id AND civicrm_domain.id = 1
civicrm_membership|SELECT civicrm_membership.id FROM civicrm_domain,civicrm_contact,civicrm_membership_type,civicrm_membership WHERE civicrm_membership.membership_type_id = civicrm_membership_type.id AND civicrm_membership_type.member_of_contact_id = civicrm_contact.id AND civicrm_contact.domain_id = civicrm_domain.id AND civicrm_domain.id = 1 UNION SELECT civicrm_membership.id FROM civicrm_domain,civicrm_contact,civicrm_membership WHERE civicrm_membership.contact_id = civicrm_contact.id AND civicrm_contact.domain_id = civicrm_domain.id AND civicrm_domain.id = 1 UNION SELECT civicrm_membership.id FROM civicrm_domain,civicrm_relationship_type,civicrm_membership_type,civicrm_membership WHERE civicrm_membership.membership_type_id = civicrm_membership_type.id AND civicrm_membership_type.relationship_type_id = civicrm_relationship_type.id AND civicrm_relationship_type.domain_id = civicrm_domain.id AND civicrm_domain.id = 1 UNION SELECT civicrm_membership.id FROM civicrm_domain,civicrm_contribution_type,civicrm_membership_type,civicrm_membership WHERE civicrm_membership.membership_type_id = civicrm_membership_type.id AND civicrm_membership_type.contribution_type_id = civicrm_contribution_type.id AND civicrm_contribution_type.domain_id = civicrm_domain.id AND civicrm_domain.id = 1 UNION SELECT civicrm_membership.id FROM civicrm_domain,civicrm_membership_status,civicrm_membership WHERE civicrm_membership.status_id = civicrm_membership_status.id AND civicrm_membership_status.domain_id = civicrm_domain.id AND civicrm_domain.id = 1 UNION SELECT civicrm_membership.id FROM civicrm_domain,civicrm_msg_template,civicrm_membership_type,civicrm_membership WHERE civicrm_membership.membership_type_id = civicrm_membership_type.id AND civicrm_membership_type.renewal_msg_id = civicrm_msg_template.id AND civicrm_msg_template.domain_id = civicrm_domain.id AND civicrm_domain.id = 1 UNION SELECT civicrm_membership.id FROM civicrm_domain,civicrm_membership_type,civicrm_membership WHERE civicrm_membership.membership_type_id = civicrm_membership_type.id AND civicrm_membership_type.domain_id = civicrm_domain.id AND civicrm_domain.id = 1
civicrm_membership_payment|SELECT civicrm_membership_payment.id FROM civicrm_domain,civicrm_contact,civicrm_membership_type,civicrm_membership,civicrm_membership_payment WHERE civicrm_membership_payment.membership_id = civicrm_membership.id AND civicrm_membership.membership_type_id = civicrm_membership_type.id AND civicrm_membership_type.member_of_contact_id = civicrm_contact.id AND civicrm_contact.domain_id = civicrm_domain.id AND civicrm_domain.id = 1 UNION SELECT civicrm_membership_payment.id FROM civicrm_domain,civicrm_contact,civicrm_membership,civicrm_membership_payment WHERE civicrm_membership_payment.membership_id = civicrm_membership.id AND civicrm_membership.contact_id = civicrm_contact.id AND civicrm_contact.domain_id = civicrm_domain.id AND civicrm_domain.id = 1 UNION SELECT civicrm_membership_payment.id FROM civicrm_domain,civicrm_relationship_type,civicrm_membership_type,civicrm_membership,civicrm_membership_payment WHERE civicrm_membership_payment.membership_id = civicrm_membership.id AND civicrm_membership.membership_type_id = civicrm_membership_type.id AND civicrm_membership_type.relationship_type_id = civicrm_relationship_type.id AND civicrm_relationship_type.domain_id = civicrm_domain.id AND civicrm_domain.id = 1 UNION SELECT civicrm_membership_payment.id FROM civicrm_domain,civicrm_contribution_type,civicrm_membership_type,civicrm_membership,civicrm_membership_payment WHERE civicrm_membership_payment.membership_id = civicrm_membership.id AND civicrm_membership.membership_type_id = civicrm_membership_type.id AND civicrm_membership_type.contribution_type_id = civicrm_contribution_type.id AND civicrm_contribution_type.domain_id = civicrm_domain.id AND civicrm_domain.id = 1 UNION SELECT civicrm_membership_payment.id FROM civicrm_domain,civicrm_membership_status,civicrm_membership,civicrm_membership_payment WHERE civicrm_membership_payment.membership_id = civicrm_membership.id AND civicrm_membership.status_id = civicrm_membership_status.id AND civicrm_membership_status.domain_id = civicrm_domain.id AND civicrm_domain.id = 1 UNION SELECT civicrm_membership_payment.id FROM civicrm_domain,civicrm_msg_template,civicrm_membership_type,civicrm_membership,civicrm_membership_payment WHERE civicrm_membership_payment.membership_id = civicrm_membership.id AND civicrm_membership.membership_type_id = civicrm_membership_type.id AND civicrm_membership_type.renewal_msg_id = civicrm_msg_template.id AND civicrm_msg_template.domain_id = civicrm_domain.id AND civicrm_domain.id = 1 UNION SELECT civicrm_membership_payment.id FROM civicrm_domain,civicrm_membership_type,civicrm_membership,civicrm_membership_payment WHERE civicrm_membership_payment.membership_id = civicrm_membership.id AND civicrm_membership.membership_type_id = civicrm_membership_type.id AND civicrm_membership_type.domain_id = civicrm_domain.id AND civicrm_domain.id = 1
civicrm_membership_log|SELECT civicrm_membership_log.id FROM civicrm_domain,civicrm_contact,civicrm_membership_type,civicrm_membership,civicrm_membership_log WHERE civicrm_membership_log.membership_id = civicrm_membership.id AND civicrm_membership.membership_type_id = civicrm_membership_type.id AND civicrm_membership_type.member_of_contact_id = civicrm_contact.id AND civicrm_contact.domain_id = civicrm_domain.id AND civicrm_domain.id = 1 UNION SELECT civicrm_membership_log.id FROM civicrm_domain,civicrm_contact,civicrm_membership,civicrm_membership_log WHERE civicrm_membership_log.membership_id = civicrm_membership.id AND civicrm_membership.contact_id = civicrm_contact.id AND civicrm_contact.domain_id = civicrm_domain.id AND civicrm_domain.id = 1 UNION SELECT civicrm_membership_log.id FROM civicrm_domain,civicrm_contact,civicrm_membership_log WHERE civicrm_membership_log.modified_id = civicrm_contact.id AND civicrm_contact.domain_id = civicrm_domain.id AND civicrm_domain.id = 1 UNION SELECT civicrm_membership_log.id FROM civicrm_domain,civicrm_relationship_type,civicrm_membership_type,civicrm_membership,civicrm_membership_log WHERE civicrm_membership_log.membership_id = civicrm_membership.id AND civicrm_membership.membership_type_id = civicrm_membership_type.id AND civicrm_membership_type.relationship_type_id = civicrm_relationship_type.id AND civicrm_relationship_type.domain_id = civicrm_domain.id AND civicrm_domain.id = 1 UNION SELECT civicrm_membership_log.id FROM civicrm_domain,civicrm_contribution_type,civicrm_membership_type,civicrm_membership,civicrm_membership_log WHERE civicrm_membership_log.membership_id = civicrm_membership.id AND civicrm_membership.membership_type_id = civicrm_membership_type.id AND civicrm_membership_type.contribution_type_id = civicrm_contribution_type.id AND civicrm_contribution_type.domain_id = civicrm_domain.id AND civicrm_domain.id = 1 UNION SELECT civicrm_membership_log.id FROM civicrm_domain,civicrm_membership_status,civicrm_membership,civicrm_membership_log WHERE civicrm_membership_log.membership_id = civicrm_membership.id AND civicrm_membership.status_id = civicrm_membership_status.id AND civicrm_membership_status.domain_id = civicrm_domain.id AND civicrm_domain.id = 1 UNION SELECT civicrm_membership_log.id FROM civicrm_domain,civicrm_membership_status,civicrm_membership_log WHERE civicrm_membership_log.status_id = civicrm_membership_status.id AND civicrm_membership_status.domain_id = civicrm_domain.id AND civicrm_domain.id = 1 UNION SELECT civicrm_membership_log.id FROM civicrm_domain,civicrm_msg_template,civicrm_membership_type,civicrm_membership,civicrm_membership_log WHERE civicrm_membership_log.membership_id = civicrm_membership.id AND civicrm_membership.membership_type_id = civicrm_membership_type.id AND civicrm_membership_type.renewal_msg_id = civicrm_msg_template.id AND civicrm_msg_template.domain_id = civicrm_domain.id AND civicrm_domain.id = 1 UNION SELECT civicrm_membership_log.id FROM civicrm_domain,civicrm_membership_type,civicrm_membership,civicrm_membership_log WHERE civicrm_membership_log.membership_id = civicrm_membership.id AND civicrm_membership.membership_type_id = civicrm_membership_type.id AND civicrm_membership_type.domain_id = civicrm_domain.id AND civicrm_domain.id = 1
civicrm_membership_block|SELECT civicrm_membership_block.id FROM civicrm_domain,civicrm_contact,civicrm_membership_type,civicrm_membership_block WHERE civicrm_membership_block.membership_type_default = civicrm_membership_type.id AND civicrm_membership_type.member_of_contact_id = civicrm_contact.id AND civicrm_contact.domain_id = civicrm_domain.id AND civicrm_domain.id = 1 UNION SELECT civicrm_membership_block.id FROM civicrm_domain,civicrm_relationship_type,civicrm_membership_type,civicrm_membership_block WHERE civicrm_membership_block.membership_type_default = civicrm_membership_type.id AND civicrm_membership_type.relationship_type_id = civicrm_relationship_type.id AND civicrm_relationship_type.domain_id = civicrm_domain.id AND civicrm_domain.id = 1 UNION SELECT civicrm_membership_block.id FROM civicrm_domain,civicrm_contribution_type,civicrm_contribution_page,civicrm_membership_block WHERE civicrm_membership_block.entity_id = civicrm_contribution_page.id AND civicrm_contribution_page.contribution_type_id = civicrm_contribution_type.id AND civicrm_contribution_type.domain_id = civicrm_domain.id AND civicrm_domain.id = 1 UNION SELECT civicrm_membership_block.id FROM civicrm_domain,civicrm_contribution_type,civicrm_membership_type,civicrm_membership_block WHERE civicrm_membership_block.membership_type_default = civicrm_membership_type.id AND civicrm_membership_type.contribution_type_id = civicrm_contribution_type.id AND civicrm_contribution_type.domain_id = civicrm_domain.id AND civicrm_domain.id = 1 UNION SELECT civicrm_membership_block.id FROM civicrm_domain,civicrm_msg_template,civicrm_membership_type,civicrm_membership_block WHERE civicrm_membership_block.membership_type_default = civicrm_membership_type.id AND civicrm_membership_type.renewal_msg_id = civicrm_msg_template.id AND civicrm_msg_template.domain_id = civicrm_domain.id AND civicrm_domain.id = 1 UNION SELECT civicrm_membership_block.id FROM civicrm_domain,civicrm_contribution_page,civicrm_membership_block WHERE civicrm_membership_block.entity_id = civicrm_contribution_page.id AND civicrm_contribution_page.domain_id = civicrm_domain.id AND civicrm_domain.id = 1 UNION SELECT civicrm_membership_block.id FROM civicrm_domain,civicrm_membership_type,civicrm_membership_block WHERE civicrm_membership_block.membership_type_default = civicrm_membership_type.id AND civicrm_membership_type.domain_id = civicrm_domain.id AND civicrm_domain.id = 1
civicrm_relationship_type|SELECT civicrm_relationship_type.id FROM civicrm_domain,civicrm_relationship_type WHERE civicrm_relationship_type.domain_id = civicrm_domain.id AND civicrm_domain.id = 1
civicrm_mailing_component|SELECT civicrm_mailing_component.id FROM civicrm_domain,civicrm_mailing_component WHERE civicrm_mailing_component.domain_id = civicrm_domain.id AND civicrm_domain.id = 1
civicrm_mailing|SELECT civicrm_mailing.id FROM civicrm_domain,civicrm_mailing_component,civicrm_mailing WHERE civicrm_mailing.header_id = civicrm_mailing_component.id AND civicrm_mailing_component.domain_id = civicrm_domain.id AND civicrm_domain.id = 1 UNION SELECT civicrm_mailing.id FROM civicrm_domain,civicrm_mailing WHERE civicrm_mailing.domain_id = civicrm_domain.id AND civicrm_domain.id = 1
civicrm_mailing_group|SELECT civicrm_mailing_group.id FROM civicrm_domain,civicrm_mailing_component,civicrm_mailing,civicrm_mailing_group WHERE civicrm_mailing_group.mailing_id = civicrm_mailing.id AND civicrm_mailing.header_id = civicrm_mailing_component.id AND civicrm_mailing_component.domain_id = civicrm_domain.id AND civicrm_domain.id = 1 UNION SELECT civicrm_mailing_group.id FROM civicrm_domain,civicrm_mailing,civicrm_mailing_group WHERE civicrm_mailing_group.mailing_id = civicrm_mailing.id AND civicrm_mailing.domain_id = civicrm_domain.id AND civicrm_domain.id = 1
civicrm_mailing_trackable_url|SELECT civicrm_mailing_trackable_url.id FROM civicrm_domain,civicrm_mailing_component,civicrm_mailing,civicrm_mailing_trackable_url WHERE civicrm_mailing_trackable_url.mailing_id = civicrm_mailing.id AND civicrm_mailing.header_id = civicrm_mailing_component.id AND civicrm_mailing_component.domain_id = civicrm_domain.id AND civicrm_domain.id = 1 UNION SELECT civicrm_mailing_trackable_url.id FROM civicrm_domain,civicrm_mailing,civicrm_mailing_trackable_url WHERE civicrm_mailing_trackable_url.mailing_id = civicrm_mailing.id AND civicrm_mailing.domain_id = civicrm_domain.id AND civicrm_domain.id = 1
civicrm_mailing_job|SELECT civicrm_mailing_job.id FROM civicrm_domain,civicrm_mailing_component,civicrm_mailing,civicrm_mailing_job WHERE civicrm_mailing_job.mailing_id = civicrm_mailing.id AND civicrm_mailing.header_id = civicrm_mailing_component.id AND civicrm_mailing_component.domain_id = civicrm_domain.id AND civicrm_domain.id = 1 UNION SELECT civicrm_mailing_job.id FROM civicrm_domain,civicrm_mailing,civicrm_mailing_job WHERE civicrm_mailing_job.mailing_id = civicrm_mailing.id AND civicrm_mailing.domain_id = civicrm_domain.id AND civicrm_domain.id = 1
civicrm_contribution_type|SELECT civicrm_contribution_type.id FROM civicrm_domain,civicrm_contribution_type WHERE civicrm_contribution_type.domain_id = civicrm_domain.id AND civicrm_domain.id = 1
civicrm_contribution_page|SELECT civicrm_contribution_page.id FROM civicrm_domain,civicrm_contribution_type,civicrm_contribution_page WHERE civicrm_contribution_page.contribution_type_id = civicrm_contribution_type.id AND civicrm_contribution_type.domain_id = civicrm_domain.id AND civicrm_domain.id = 1 UNION SELECT civicrm_contribution_page.id FROM civicrm_domain,civicrm_contribution_page WHERE civicrm_contribution_page.domain_id = civicrm_domain.id AND civicrm_domain.id = 1
civicrm_financial_trxn|SELECT civicrm_financial_trxn.id FROM civicrm_domain,civicrm_financial_trxn WHERE civicrm_financial_trxn.domain_id = civicrm_domain.id AND civicrm_domain.id = 1
civicrm_product|SELECT civicrm_product.id FROM civicrm_domain,civicrm_product WHERE civicrm_product.domain_id = civicrm_domain.id AND civicrm_domain.id = 1
civicrm_premiums_product|SELECT civicrm_premiums_product.id FROM civicrm_domain,civicrm_product,civicrm_premiums_product WHERE civicrm_premiums_product.product_id = civicrm_product.id AND civicrm_product.domain_id = civicrm_domain.id AND civicrm_domain.id = 1
civicrm_project|SELECT civicrm_project.id FROM civicrm_domain,civicrm_project WHERE civicrm_project.domain_id = civicrm_domain.id AND civicrm_domain.id = 1
civicrm_task|SELECT civicrm_task.id FROM civicrm_domain,civicrm_task WHERE civicrm_task.domain_id = civicrm_domain.id AND civicrm_domain.id = 1
civicrm_task_status|SELECT civicrm_task_status.id FROM civicrm_domain,civicrm_task,civicrm_task_status WHERE civicrm_task_status.task_id = civicrm_task.id AND civicrm_task.domain_id = civicrm_domain.id AND civicrm_domain.id = 1
civicrm_membership_status|SELECT civicrm_membership_status.id FROM civicrm_domain,civicrm_membership_status WHERE civicrm_membership_status.domain_id = civicrm_domain.id AND civicrm_domain.id = 1
civicrm_msg_template|SELECT civicrm_msg_template.id FROM civicrm_domain,civicrm_msg_template WHERE civicrm_msg_template.domain_id = civicrm_domain.id AND civicrm_domain.id = 1
civicrm_event|SELECT civicrm_event.id FROM civicrm_domain,civicrm_event WHERE civicrm_event.domain_id = civicrm_domain.id AND civicrm_domain.id = 1
civicrm_custom_group|SELECT civicrm_custom_group.id FROM civicrm_domain,civicrm_custom_group WHERE civicrm_custom_group.domain_id = civicrm_domain.id AND civicrm_domain.id = 1
civicrm_country|SELECT civicrm_country.id FROM civicrm_country
civicrm_custom_option|SELECT civicrm_custom_option.id FROM civicrm_custom_option
civicrm_geo_coord|SELECT civicrm_geo_coord.id FROM civicrm_geo_coord
civicrm_state_province|SELECT civicrm_state_province.id FROM civicrm_state_province
civicrm_file|SELECT civicrm_file.id FROM civicrm_file
civicrm_entity_file|SELECT civicrm_entity_file.id FROM civicrm_entity_file
civicrm_currency|SELECT civicrm_currency.id FROM civicrm_currency
civicrm_mailing_bounce_type|SELECT civicrm_mailing_bounce_type.id FROM civicrm_mailing_bounce_type
civicrm_mailing_bounce_pattern|SELECT civicrm_mailing_bounce_pattern.id FROM civicrm_mailing_bounce_pattern
civicrm_premiums|SELECT civicrm_premiums.id FROM civicrm_premiums
civicrm_event_page|SELECT civicrm_event_page.id FROM civicrm_event_page
civicrm_county|SELECT civicrm_county.id FROM civicrm_county
