瀏覽代碼

fix distinct & count bug

xormplus 8 年之前
父節點
當前提交
c83bfe36f1
共有 1 個文件被更改,包括 1 次插入1 次删除
  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 "
 	}