diff --git a/finisher_api.go b/finisher_api.go index 528f32be..e757bfe9 100644 --- a/finisher_api.go +++ b/finisher_api.go @@ -378,7 +378,7 @@ func (db *DB) Count(count *int64) (tx *DB) { if len(tx.Statement.Selects) == 0 { tx.Statement.AddClause(clause.Select{Expression: clause.Expr{SQL: "count(1)"}}) - } else if !strings.Contains(strings.ToLower(tx.Statement.Selects[0]), "count(") { + } else if !strings.HasPrefix(strings.TrimSpace(strings.ToLower(tx.Statement.Selects[0])), "count(") { expr := clause.Expr{SQL: "count(1)"} if len(tx.Statement.Selects) == 1 {