Fix duplicates in multi-list campaigns with overlapping subscribers.

This commit is contained in:
Kailash Nadh 2018-11-26 18:16:20 +05:30
parent 8a952c137b
commit 4cd66d1790
1 changed files with 1 additions and 1 deletions

View File

@ -259,7 +259,7 @@ WITH camp AS (
WHERE id=$1 AND status='running'
),
subs AS (
SELECT * FROM subscribers
SELECT DISTINCT ON(id) id AS uniq_id, * FROM subscribers
LEFT JOIN subscriber_lists ON (subscribers.id = subscriber_lists.subscriber_id AND subscriber_lists.status != 'unsubscribed')
WHERE subscriber_lists.list_id=ANY(
SELECT list_id FROM campaign_lists where campaign_id=$1 AND list_id IS NOT NULL