include order by for group SQL

This commit is contained in:
Jinzhu 2015-09-17 21:39:16 +08:00
parent 2a46856d52
commit 073fa4dc85
1 changed files with 1 additions and 1 deletions

View File

@ -213,7 +213,7 @@ func (scope *Scope) selectSql() string {
return "*"
}
sql := scope.buildSelectQuery(scope.Search.selects)
scope.Search.countingQuery = hasCountRegexp.MatchString(sql)
scope.Search.countingQuery = (len(scope.Search.group) == 0) && hasCountRegexp.MatchString(sql)
return scope.buildSelectQuery(scope.Search.selects)
}