Having specify HAVING conditions for GROUP BY // Select the sum age of users with name jinzhu db.Model(&User{}).Select("name, sum(age) as total").Group("name").Having("name = ?", "jinzhu").Find(&result)
(query interface{}, args ...interface{})
| 295 | // // Select the sum age of users with name jinzhu |
| 296 | // db.Model(&User{}).Select("name, sum(age) as total").Group("name").Having("name = ?", "jinzhu").Find(&result) |
| 297 | func (db *DB) Having(query interface{}, args ...interface{}) (tx *DB) { |
| 298 | tx = db.getInstance() |
| 299 | tx.Statement.AddClause(clause.GroupBy{ |
| 300 | Having: tx.Statement.BuildCondition(query, args...), |
| 301 | }) |
| 302 | return |
| 303 | } |
| 304 | |
| 305 | // Order specify order when retrieving records from database |
| 306 | // |
nothing calls this directly
no test coverage detected