Commit b025761f authored by webchick's avatar webchick

Issue #2315269 by sun: Fixed Entity/Query/Sql/QueryAggregate: PDOException:...

Issue #2315269 by sun: Fixed Entity/Query/Sql/QueryAggregate: PDOException: General error: GROUP BY clause is required before HAVING.
parent fd0be046
...@@ -160,12 +160,14 @@ public function testAggregation() { ...@@ -160,12 +160,14 @@ public function testAggregation() {
// Apply aggregation and a condition which matches. // Apply aggregation and a condition which matches.
$this->queryResult = $this->factory->getAggregate('entity_test') $this->queryResult = $this->factory->getAggregate('entity_test')
->aggregate('id', 'COUNT') ->aggregate('id', 'COUNT')
->groupBy('id')
->conditionAggregate('id', 'COUNT', 8) ->conditionAggregate('id', 'COUNT', 8)
->execute(); ->execute();
$this->assertResults(array()); $this->assertResults(array());
// Don't call aggregate to test the implicit aggregate call. // Don't call aggregate to test the implicit aggregate call.
$this->queryResult = $this->factory->getAggregate('entity_test') $this->queryResult = $this->factory->getAggregate('entity_test')
->groupBy('id')
->conditionAggregate('id', 'COUNT', 8) ->conditionAggregate('id', 'COUNT', 8)
->execute(); ->execute();
$this->assertResults(array()); $this->assertResults(array());
...@@ -173,6 +175,7 @@ public function testAggregation() { ...@@ -173,6 +175,7 @@ public function testAggregation() {
// Apply aggregation and a condition which matches. // Apply aggregation and a condition which matches.
$this->queryResult = $this->factory->getAggregate('entity_test') $this->queryResult = $this->factory->getAggregate('entity_test')
->aggregate('id', 'count') ->aggregate('id', 'count')
->groupBy('id')
->conditionAggregate('id', 'COUNT', 6) ->conditionAggregate('id', 'COUNT', 6)
->execute(); ->execute();
$this->assertResults(array(array('id_count' => 6))); $this->assertResults(array(array('id_count' => 6)));
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment