diff --git a/src/bb-library/Model/ForumTopicTable.php b/src/bb-library/Model/ForumTopicTable.php index 274d69c52..8ce9ad7ab 100644 --- a/src/bb-library/Model/ForumTopicTable.php +++ b/src/bb-library/Model/ForumTopicTable.php @@ -67,7 +67,7 @@ class Model_ForumTopicTable implements \Box\InjectionAwareInterface if (!empty($where)) { $query = $query . ' WHERE ' . implode(' AND ', $where); } - $query .= " GROUP BY ft.id ORDER BY ft.sticky DESC, ftm.id DESC"; + $query .= " ORDER BY ft.sticky DESC, ftm.id DESC"; return array($query, $bindings); } diff --git a/src/bb-modules/Forum/Api/Admin.php b/src/bb-modules/Forum/Api/Admin.php index ad73b3b4b..5c71e713d 100644 --- a/src/bb-modules/Forum/Api/Admin.php +++ b/src/bb-modules/Forum/Api/Admin.php @@ -105,7 +105,7 @@ class Admin extends \Api_Abstract $systemService = $this->di['mod_service']('system'); $systemService->checkLimits('Model_Forum', 3); - $priority = $this->di['db']->getCell("SELECT MAX(priority) FROM forum GROUP BY priority ORDER BY priority DESC LIMIT 1"); + $priority = $this->di['db']->getCell("SELECT MAX(priority) FROM forum LIMIT 1"); $model = $this->di['db']->dispense('Forum'); $model->category = $this->di['array_get']($data, 'category', NULL); diff --git a/src/bb-modules/Forum/Service.php b/src/bb-modules/Forum/Service.php index 1b524dd0d..e88a1562c 100644 --- a/src/bb-modules/Forum/Service.php +++ b/src/bb-modules/Forum/Service.php @@ -81,8 +81,8 @@ class Service implements InjectionAwareInterface $sql .= ' AND c.first_name LIKE :first_char'; $params['first_char'] = $first_char.'%'; } - - $sql .= ' GROUP BY c.id ORDER BY c.first_name DESC '; + + $sql .= ' ORDER BY c.first_name DESC '; return array($sql, $params); } diff --git a/src/bb-modules/Invoice/Service.php b/src/bb-modules/Invoice/Service.php index 541712ab0..637cb7848 100644 --- a/src/bb-modules/Invoice/Service.php +++ b/src/bb-modules/Invoice/Service.php @@ -130,7 +130,7 @@ class Service implements InjectionAwareInterface $params['search'] = $search; } - $sql .= ' GROUP BY p.id ORDER BY p.id DESC'; + $sql .= ' ORDER BY p.id DESC'; return array($sql, $params); } diff --git a/src/bb-modules/Kb/Service.php b/src/bb-modules/Kb/Service.php index 5750b8fb6..25d3558e3 100644 --- a/src/bb-modules/Kb/Service.php +++ b/src/bb-modules/Kb/Service.php @@ -215,7 +215,7 @@ class Service $sql = $sql . ' WHERE ' . implode(' AND ', $where); } - $sql = $sql . " GROUP BY kac.id ORDER BY kac.id DESC"; + $sql = $sql . " ORDER BY kac.id DESC"; return array($sql, $bindings); } diff --git a/src/bb-modules/Massmailer/Service.php b/src/bb-modules/Massmailer/Service.php index cf7abd0cd..b2cf00355 100644 --- a/src/bb-modules/Massmailer/Service.php +++ b/src/bb-modules/Massmailer/Service.php @@ -109,7 +109,7 @@ class Service implements \Box\InjectionAwareInterface } } - $sql .= ' GROUP BY c.id ORDER BY c.id DESC'; + $sql .= ' ORDER BY c.id DESC'; if(isset($data['debug']) && $data['debug']) { throw new \Exception($sql. ' '. print_r($values, 1)); diff --git a/src/bb-modules/Order/Service.php b/src/bb-modules/Order/Service.php index 9171e2c20..c62368f20 100644 --- a/src/bb-modules/Order/Service.php +++ b/src/bb-modules/Order/Service.php @@ -480,7 +480,7 @@ class Service implements InjectionAwareInterface if (!empty($where)) { $query = $query . ' WHERE ' . implode(' AND ', $where); } - $query .= " GROUP by co.id ORDER BY co.id DESC"; + $query .= " ORDER BY co.id DESC"; return array($query, $bindings); } diff --git a/src/bb-modules/Product/Service.php b/src/bb-modules/Product/Service.php index dfae6aba7..5de1b931c 100644 --- a/src/bb-modules/Product/Service.php +++ b/src/bb-modules/Product/Service.php @@ -175,7 +175,7 @@ class Service implements InjectionAwareInterface { $systemService = $this->di['mod_service']('system'); $systemService->checkLimits('Model_Product', 5); - $sql = "SELECT MAX(priority) FROM product GROUP BY priority ORDER BY priority DESC LIMIT 1"; + $sql = "SELECT MAX(priority) FROM product LIMIT 1"; $priority = $this->di['db']->getCell($sql); $modelPayment = $this->di['db']->dispense('ProductPayment'); diff --git a/src/bb-modules/Support/Service.php b/src/bb-modules/Support/Service.php index aca780d72..d04ef720c 100644 --- a/src/bb-modules/Support/Service.php +++ b/src/bb-modules/Support/Service.php @@ -355,7 +355,7 @@ class Service implements \Box\InjectionAwareInterface $query = $query . ' WHERE ' . implode(' AND ', $where); } - $query .= " GROUP BY st.id ORDER BY st.priority ASC, st.id DESC"; + $query .= " ORDER BY st.priority ASC, st.id DESC"; return array($query, $bindings); } @@ -1055,7 +1055,7 @@ class Service implements \Box\InjectionAwareInterface $query = $query . ' WHERE ' . implode(' AND ', $where); } - $query .= " GROUP BY spt.id, sptm.id ORDER BY spt.id DESC, sptm.id ASC"; + $query .= " ORDER BY spt.id DESC, sptm.id ASC"; return array($query, $bindings); } diff --git a/tests/bb-modules/Kb/ServiceTest.php b/tests/bb-modules/Kb/ServiceTest.php index c749facc6..bc1a31027 100644 --- a/tests/bb-modules/Kb/ServiceTest.php +++ b/tests/bb-modules/Kb/ServiceTest.php @@ -351,7 +351,7 @@ class ServiceTest extends \BBTestCase ' SELECT kac.* FROM kb_article_category kac - LEFT JOIN kb_article ka ON kac.id = ka.kb_article_category_id GROUP BY kac.id ORDER BY kac.id DESC', + LEFT JOIN kb_article ka ON kac.id = ka.kb_article_category_id ORDER BY kac.id DESC', array(), ), array( @@ -361,7 +361,7 @@ class ServiceTest extends \BBTestCase 'SELECT kac.* FROM kb_article_category kac LEFT JOIN kb_article ka ON kac.id = ka.kb_article_category_id - WHERE ka.status = :status GROUP BY kac.id ORDER BY kac.id DESC', + WHERE ka.status = :status ORDER BY kac.id DESC', array( ':status' => 'active', ), @@ -373,7 +373,7 @@ class ServiceTest extends \BBTestCase 'SELECT kac.* FROM kb_article_category kac LEFT JOIN kb_article ka ON kac.id = ka.kb_article_category_id - WHERE (ka.title LIKE :title OR ka.content LIKE :content) GROUP BY kac.id ORDER BY kac.id DESC', + WHERE (ka.title LIKE :title OR ka.content LIKE :content) ORDER BY kac.id DESC', array( ':title' => '%search query%', ':content' => '%search query%', @@ -387,7 +387,7 @@ class ServiceTest extends \BBTestCase 'SELECT kac.* FROM kb_article_category kac LEFT JOIN kb_article ka ON kac.id = ka.kb_article_category_id - WHERE ka.status = :status AND (ka.title LIKE :title OR ka.content LIKE :content) GROUP BY kac.id ORDER BY kac.id DESC', + WHERE ka.status = :status AND (ka.title LIKE :title OR ka.content LIKE :content) ORDER BY kac.id DESC', array( ':title' => '%search query%', ':content' => '%search query%',