Skip to content

Commit

Permalink
Add quotes to the table names
Browse files Browse the repository at this point in the history
  • Loading branch information
mlewis-everley committed Sep 10, 2020
1 parent 124952b commit 536d68f
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions src/model/Contact.php
Original file line number Diff line number Diff line change
Expand Up @@ -244,11 +244,11 @@ public static function getByMostLocations()
$id = null;
$query = new SQLSelect();
$query
->setFrom('Contact')
->setSelect('Contact.ID, count(ContactLocation.ID) as LocationsCount')
->addLeftJoin('ContactLocation', 'Contact.ID = ContactLocation.ContactID')
->addGroupBy('Contact.ID')
->addOrderBy('LocationsCount', 'DESC')
->setFrom('"Contact"')
->setSelect('"Contact"."ID", count("ContactLocation"."ID") as LocationsCount')
->addLeftJoin('ContactLocation', '"Contact"."ID" = "ContactLocation"."ContactID"')
->addGroupBy('"Contact"."ID"')
->addOrderBy('"LocationsCount"', 'DESC')
->setLimit(1);

foreach ($query->execute() as $row) {
Expand Down

0 comments on commit 536d68f

Please sign in to comment.