From 4748d9aef5c15b1c3ac68d7a68ce6d780b251f06 Mon Sep 17 00:00:00 2001 From: Vitaliy Filippov Date: Tue, 9 Apr 2013 15:12:57 +0000 Subject: [PATCH] empty(group by) --- DatabaseMysql.php | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/DatabaseMysql.php b/DatabaseMysql.php index 90baa23..869068a 100644 --- a/DatabaseMysql.php +++ b/DatabaseMysql.php @@ -432,15 +432,15 @@ class DatabaseMysql implements Database { $sql .= " WHERE $where"; } - if (isset($options['GROUP BY'])) + if (!empty($options['GROUP BY']) && $options['GROUP BY'] !== '0') { $sql .= " GROUP BY ".$this->order_option($options['GROUP BY']); } - if (isset($options['ORDER BY'])) + if (!empty($options['ORDER BY']) && $options['GROUP BY'] !== '0') { $sql .= " ORDER BY ".$this->order_option($options['ORDER BY']); } - if (isset($options['WITHIN GROUP ORDER BY'])) + if (!empty($options['WITHIN GROUP ORDER BY']) && $options['WITHIN GROUP GROUP BY'] !== '0') { // Sphinx Search extension $sql .= " WITHIN GROUP ORDER BY ".$this->order_option($options['WITHIN GROUP ORDER BY']);