Browse Source

fix distinct & count bug

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

+ 1 - 1
statement.go

@@ -1167,7 +1167,7 @@ func (statement *Statement) genSumSQL(bean interface{}, columns ...string) (stri
 
 func (statement *Statement) genSelectSQL(columnStr, condSQL string) (a string) {
 	var distinct string
-	if statement.IsDistinct {
+	if statement.IsDistinct && !strings.HasPrefix(columnStr, "count") {
 		distinct = "DISTINCT "
 	}