Skip to content

Commit

Permalink
add prefix to tables in raw select
Browse files Browse the repository at this point in the history
  • Loading branch information
molin002 committed Feb 22, 2021
1 parent e3c8ce4 commit ce0a3e6
Showing 1 changed file with 1 addition and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -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()))
Expand Down

0 comments on commit ce0a3e6

Please # to comment.