t.Errorf("no error should happen, but got %v",err)
}
ifname!="groupby"||total!=60{
t.Errorf("name should be groupby, but got %v, total should be 60, but got %v",name,total)
}
iferr:=DB.Model(&User{}).Select("name, sum(age) as total").Where("name LIKE ?","groupby%").Group("name").Having("name = ?","groupby1").Row().Scan(&name,&total);err!=nil{
t.Errorf("no error should happen, but got %v",err)
}
ifname!="groupby1"||total!=660{
t.Errorf("name should be groupby, but got %v, total should be 660, but got %v",name,total)