Merge pull request #718 from boxbilling/fix/group-by

Fixes group by
This commit is contained in:
Andrius Putna authored and GitHub committed 2020-11-04 22:27:10 +02:00
commit b47a4ab099
10 files changed
+15 -15

No files matched your search

+1 -1
View File
@@ -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);
}
+1 -1
View File
@@ -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);
+2 -2
View File
@@ -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);
}
+1 -1
View File
@@ -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);
}
+1 -1
View File
@@ -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);
}
+1 -1
View File
@@ -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));
+1 -1
View File
@@ -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);
}
+1 -1
View File
@@ -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');
+2 -2
View File
@@ -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);
}
+4 -4
View File
@@ -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%',