Skip to content

Commit

Permalink
Fix counting unsubbed users in campaign stats counts
Browse files Browse the repository at this point in the history
  • Loading branch information
knadh committed Nov 26, 2018
1 parent c132af2 commit cf5df3e
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion queries.sql
Original file line number Diff line number Diff line change
Expand Up @@ -243,7 +243,7 @@ counts AS (
SELECT id AS campaign_id, COUNT(subscriber_lists.subscriber_id) AS to_send,
COALESCE(MAX(subscriber_lists.subscriber_id), 0) AS max_subscriber_id FROM camps
LEFT JOIN campaign_lists ON (campaign_lists.campaign_id = camps.id)
LEFT JOIN subscriber_lists ON (subscriber_lists.list_id = campaign_lists.list_id)
LEFT JOIN subscriber_lists ON (subscriber_lists.list_id = campaign_lists.list_id AND subscriber_lists.status != 'unsubscribed')
WHERE campaign_lists.campaign_id = ANY(SELECT id FROM camps)
GROUP BY camps.id
),
Expand Down

0 comments on commit cf5df3e

Please sign in to comment.