From 49a33dd5d0cb3b6c20f1a4f7e1ae1fad95f7cdb8 Mon Sep 17 00:00:00 2001 From: Jinzhu Date: Sun, 22 Feb 2015 22:40:12 +0800 Subject: [PATCH] Remove other select conditions for count --- scope_private.go | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/scope_private.go b/scope_private.go index 84881d00..aa685cd6 100644 --- a/scope_private.go +++ b/scope_private.go @@ -370,7 +370,9 @@ func (scope *Scope) pluck(column string, value interface{}) *Scope { } func (scope *Scope) count(value interface{}) *Scope { - scope.Search = scope.Search.clone().selects("count(*)") + scope.Search = scope.Search.clone() + scope.Search.Selects = []map[string]interface{}{} + scope.Search.selects("count(*)") scope.Err(scope.row().Scan(value)) return scope }