distinc count
This commit is contained in:
parent
1f455336b2
commit
26f36a2c8e
|
@ -1142,6 +1142,9 @@ func (statement *Statement) genCountSQL(bean interface{}) (string, []interface{}
|
||||||
|
|
||||||
var selectSql = statement.selectStr
|
var selectSql = statement.selectStr
|
||||||
if len(selectSql) <= 0 {
|
if len(selectSql) <= 0 {
|
||||||
|
if statement.IsDistinct {
|
||||||
|
selectSql = fmt.Sprintf("count(DISTINCT %s)", statement.ColumnStr)
|
||||||
|
}
|
||||||
selectSql = "count(*)"
|
selectSql = "count(*)"
|
||||||
}
|
}
|
||||||
return statement.genSelectSQL(selectSql, condSQL), append(statement.joinArgs, condArgs...)
|
return statement.genSelectSQL(selectSql, condSQL), append(statement.joinArgs, condArgs...)
|
||||||
|
|
Loading…
Reference in New Issue