It seems that the union in the query acheived the same thing as the IF
clause in the revised query.
";
}
- $orderByInner = "";
- $orderByOuter = "ORDER BY exactFirst";
+ $orderByInner = $orderByOuter = "ORDER BY exactFirst";
if ($config->includeOrderByClause) {
$orderByInner = "ORDER BY sort_name";
$orderByOuter .= ", sort_name";
FROM civicrm_contact cc {$from}
{$aclFrom}
{$additionalFrom} {$includeEmailFrom}
- {$exactWhereClause}
+ {$whereClause}
+ {$orderByInner}
LIMIT 0, {$limit} )
";
if ($whereClause != $exactWhereClause) {