fix: count() when use group by
and only find one record
This commit is contained in:
parent
ae5bda7deb
commit
cb6e71b35a
@ -420,7 +420,7 @@ func (db *DB) Count(count *int64) (tx *DB) {
|
|||||||
tx.Statement.Dest = count
|
tx.Statement.Dest = count
|
||||||
tx = tx.callbacks.Query().Execute(tx)
|
tx = tx.callbacks.Query().Execute(tx)
|
||||||
|
|
||||||
if _, ok := db.Statement.Clauses["GROUP BY"]; (ok && tx.RowsAffected == 1) || tx.RowsAffected != 1 {
|
if _, ok := db.Statement.Clauses["GROUP BY"]; ok || tx.RowsAffected != 1 {
|
||||||
*count = tx.RowsAffected
|
*count = tx.RowsAffected
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user