Выводит три записи, но две одинаковые
SELECT
:projection,
"user".firstname || ' ' || "user".lastname AS created_by,
"campaign_status".name as status
FROM campaign
LEFT JOIN :user "user" ON campaign.user_id="user".id
LEFT JOIN :campaign_status "campaign_status" ON campaign.campaign_status_id="campaign_status".id
LEFT JOIN user_group "user_group" ON "user".id = "user_group".user_id
WHERE
"user_group".group_id = $groupId
AND (campaign.search @> '{"tags_in": [$tagId]}' AND not(campaign.search @> '{"contacts_out": [$contactId]}'))
OR (campaign.search @> '{"contacts_in": [$contactId]}')
GROUP BY campaign.id, "user".id, "campaign_status".id
ORDER BY :sortBy :orderBy
LIMIT $limit OFFSET ($page - 1) * $limit
Почему это может случаться?