diff --git a/src/Repositories/Campaigns/BaseCampaignTenantRepository.php b/src/Repositories/Campaigns/BaseCampaignTenantRepository.php index 5e43d69b..241a1bc7 100644 --- a/src/Repositories/Campaigns/BaseCampaignTenantRepository.php +++ b/src/Repositories/Campaigns/BaseCampaignTenantRepository.php @@ -43,7 +43,7 @@ public function getCounts(Collection $campaignIds, int $workspaceId): array ->where('sendportal_messages.workspace_id', $workspaceId); }) ->select('sendportal_campaigns.id as campaign_id') - ->selectRaw('count(sendportal_messages.id) as total') + ->selectRaw(sprintf('count(%ssendportal_messages.id) as total', DB::getTablePrefix())) ->selectRaw(sprintf('count(case when %ssendportal_messages.opened_at IS NOT NULL then 1 end) as opened', DB::getTablePrefix())) ->selectRaw(sprintf('count(case when %ssendportal_messages.clicked_at IS NOT NULL then 1 end) as clicked', DB::getTablePrefix())) ->selectRaw(sprintf('count(case when %ssendportal_messages.sent_at IS NOT NULL then 1 end) as sent', DB::getTablePrefix()))