diff --git a/etemplate/inc/class.so_sql.inc.php b/etemplate/inc/class.so_sql.inc.php index 042891c501..01a372885a 100644 --- a/etemplate/inc/class.so_sql.inc.php +++ b/etemplate/inc/class.so_sql.inc.php @@ -962,7 +962,7 @@ class so_sql $num_rows = 0; // as spec. in max_matches in the user-prefs if (is_array($start)) list($start,$num_rows) = $start; - if ($order_by && stripos($order_by,'ORDER BY')===false && stripos($order_by,'GROUP BY')===false) + if ($order_by && stripos($order_by,'ORDER BY')===false && stripos($order_by,'GROUP BY')===false && stripos($order_by,'HAVING')===false) { $order_by = 'ORDER BY '.$order_by; }