最近发布的主题
最近发布的文章
暂无
最近分享的资源
暂无
最近发布的项目
暂无
最近的评论
-
评论了主题 golang gorm 怎么得到sum()值?#1楼 @blackhilloldmonster var totalScore []int db.Table("xy_subject_answer a"). / Select("SUM(a.fraction) as totalScore"). / Joins("left join xy_staff_auswer_option b on (a.id = b.subject_answer_id)"). Where("b.staff_answer_id = ?", 282).Pluck("SUM(a.fraction)", &totalScore) 我按你的这么写了,还是不行,最终用的上面的这段,得到了正确的结果
-
评论了主题 golang gorm 怎么得到sum()值?var totalScore []int db.Table("xy_subject_answer a"). /* Select("SUM(a.fraction) as totalScore"). */ Joins("left join xy_staff_auswer_option b on (a.id = b.subject_answer_id)"). Where("b.staff_answer_id = ?", 282).Pluck("SUM(a.fraction)", &totalScore) 我按你的这么写了,还是不行,最终用的上面的这段,得到了正确的结果