From: eileenmcnaugton Date: Sat, 22 Aug 2015 08:02:04 +0000 (+1200) Subject: CRM-17023, CRM-10687, CRM-12326 query simplification X-Git-Url: https://vcs.fsf.org/?a=commitdiff_plain;h=c14e8c3642d6ca66e05c50312b1aa9937a80828d;p=civicrm-core.git CRM-17023, CRM-10687, CRM-12326 query simplification It seems that the union in the query acheived the same thing as the IF clause in the revised query. --- diff --git a/api/v3/Contact.php b/api/v3/Contact.php index a49bcbad17..84227531db 100644 --- a/api/v3/Contact.php +++ b/api/v3/Contact.php @@ -877,8 +877,7 @@ function civicrm_api3_contact_getquick($params) { "; } - $orderByInner = ""; - $orderByOuter = "ORDER BY exactFirst"; + $orderByInner = $orderByOuter = "ORDER BY exactFirst"; if ($config->includeOrderByClause) { $orderByInner = "ORDER BY sort_name"; $orderByOuter .= ", sort_name"; @@ -895,7 +894,8 @@ function civicrm_api3_contact_getquick($params) { FROM civicrm_contact cc {$from} {$aclFrom} {$additionalFrom} {$includeEmailFrom} - {$exactWhereClause} + {$whereClause} + {$orderByInner} LIMIT 0, {$limit} ) "; if ($whereClause != $exactWhereClause) {