Commit | Line | Data |
---|---|---|
72cec3ac AE |
1 | |
2 | -- SPDX-FileCopyrightText: 2023 Andrew Engelbrecht | |
3 | -- | |
4 | -- SPDX-License-Identifier: GPL-3.0-or-later | |
5 | ||
6 | select c.id from civicrm_contact c | |
7 | where c.is_deleted = 0 | |
8 | and c.id not in ( | |
9 | select contact_id from civicrm_group_contact | |
10 | where id = 1978 and status = 'Added' -- adhoc exclusion group | |
11 | ) and ( | |
12 | c.id not in ( | |
13 | select contact_id from civicrm_membership | |
14 | where status_id in (1, 2, 3) -- is a member: new, current or grace | |
15 | ) and ( | |
16 | c.id in ( | |
17 | select contact_id from civicrm_membership | |
18 | where status_id in (1, 2, 3, 4) and end_date >= '2018-01-19' and join_date <= '2022-10-19' -- was a member during time period | |
19 | ) or c.id in ( | |
20 | select contact_id from civicrm_contribution | |
21 | where contribution_status_id = 1 and receive_date >= '2018-01-19' and receive_date <= '2022-10-19' | |
22 | group by contact_id | |
23 | having sum(total_amount) >= '120.00' -- donated $120 or more during time period | |
24 | ) | |
25 | ) | |
26 | ) order by id asc | |
27 | into outfile '/var/lib/mysql-files/board-forum-contacts-on-join2.csv' fields terminated by ',' | |
28 | ; | |
29 |