From 51568ba4ab0da8fd382af023f8400c366b70bf88 Mon Sep 17 00:00:00 2001 From: Jinzhu Date: Wed, 2 Dec 2020 17:27:07 +0800 Subject: [PATCH] Delete select clause after Count, close #3814 --- finisher_api.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/finisher_api.go b/finisher_api.go index fc7a73be..d36dc754 100644 --- a/finisher_api.go +++ b/finisher_api.go @@ -377,7 +377,7 @@ func (db *DB) Count(count *int64) (tx *DB) { } tx.Statement.AddClause(clause.Select{Expression: expr}) - defer tx.Statement.AddClause(clause.Select{}) + defer delete(tx.Statement.Clauses, "SELECT") } if orderByClause, ok := db.Statement.Clauses["ORDER BY"]; ok {