empty(group by)

master
Vitaliy Filippov 2013-04-09 15:12:57 +00:00
parent d43256ad58
commit 4748d9aef5
1 changed files with 3 additions and 3 deletions

View File

@ -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']);