fix aggregate selecting bug.

This commit is contained in:
Taylor Otwell 2012-01-30 10:38:12 -06:00
parent 6c1e3578ad
commit ea13ddfb7f
2 changed files with 7 additions and 0 deletions

View File

@ -75,6 +75,11 @@ final protected function concatenate($components)
*/
protected function selects(Query $query)
{
// Sometimes developers may set a "select" clause on the same query that
// is performing in aggregate look-up, such as during pagination. So we
// will not generate the select clause if an aggregate is present.
if ( ! is_null($query->aggregate)) return;
$select = ($query->distinct) ? 'SELECT DISTINCT ' : 'SELECT ';
return $select.$this->columnize($query->selects);

View File

@ -44,6 +44,8 @@ public function select(Query $query)
*/
protected function selects(Query $query)
{
if ( ! is_null($query->aggregate)) return;
$select = ($query->distinct) ? 'SELECT DISTINCT ' : 'SELECT ';
// Instead of using a "LIMIT" keyword, SQL Server uses the "TOP"