diff --git a/scope_private.go b/scope_private.go index 5b04a639..74adf1ff 100644 --- a/scope_private.go +++ b/scope_private.go @@ -217,7 +217,7 @@ func (scope *Scope) selectSql() string { } sql := scope.buildSelectQuery(scope.Search.selects) scope.Search.countingQuery = (len(scope.Search.group) == 0) && hasCountRegexp.MatchString(sql) - return scope.buildSelectQuery(scope.Search.selects) + return sql } func (scope *Scope) orderSql() string {