Commit ea13ddfb by Taylor Otwell

fix aggregate selecting bug.

parent 6c1e3578
......@@ -75,6 +75,11 @@ class Grammar extends \Laravel\Database\Grammar {
*/
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);
......
......@@ -44,6 +44,8 @@ class SQLServer extends Grammar {
*/
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"
......
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