Permalink
Browse files

Include all columns to allow SQL Server to ORDER BY on the outside

  • Loading branch information...
CraigMason committed Oct 18, 2012
1 parent b5e19dc commit b416d3b2a38495e4435bde872b19fec371fe5657
@@ -121,10 +121,20 @@ public function walkSelectStatement(SelectStatement $AST)
}
// Build the counter query
+ /*
return sprintf('SELECT %s AS dctrn_count FROM (SELECT DISTINCT %s FROM (%s) dctrn_result) dctrn_table',
$this->platform->getCountExpression('*'),
implode(', ', $sqlIdentifier),
$sql
);
+ *
+ */
+
+ // Build the counter query
+ return sprintf('SELECT %s AS dctrn_count FROM (SELECT DISTINCT %s FROM (%s) dctrn_result) dctrn_table',
+ $this->platform->getCountExpression('*'),
+ '*',
+ $sql
+ );
}
}
@@ -132,8 +132,12 @@ public function walkSelectStatement(SelectStatement $AST)
}
// Build the counter query
- $sql = sprintf('SELECT DISTINCT %s FROM (%s) dctrn_result',
+ /*
+ $sql = sprintf('SELECT DISTINCT %s, FROM (%s) dctrn_result',
implode(', ', $sqlIdentifier), $sql);
+ */
+
+ $sql = sprintf('SELECT DISTINCT * FROM (%s) dctrn_result', $sql);
// Apply the limit and offset
$sql = $this->platform->modifyLimitQuery(

0 comments on commit b416d3b

Please sign in to comment.