From 0d9762712b6978b33d9df5a5df2077a71a303e27 Mon Sep 17 00:00:00 2001 From: Lunny Xiao Date: Sat, 11 Mar 2017 21:24:37 +0800 Subject: [PATCH] fix distinct & count bug --- statement.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/statement.go b/statement.go index 83b7fbc3..d8bb44fe 100644 --- a/statement.go +++ b/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 " }