Browse Source

fix bug on sum

xormplus 8 years ago
parent
commit
ba0af156f8
1 changed files with 1 additions and 1 deletions
  1. 1 1
      statement.go

+ 1 - 1
statement.go

@@ -1188,7 +1188,7 @@ func (statement *Statement) genSumSQL(bean interface{}, columns ...string) (stri
 
 	var sumStrs = make([]string, 0, len(columns))
 	for _, colName := range columns {
-		if !strings.Contains(colName, " ") && strings.Contains(colName, "(") {
+		if !strings.Contains(colName, " ") && !strings.Contains(colName, "(") {
 			colName = statement.Engine.Quote(colName)
 		}
 		sumStrs = append(sumStrs, fmt.Sprintf("COALESCE(sum(%s),0)", colName))