如何解决sum
需要总结同名学生的时长
select (select concat(first_name,' ',last_name) from users where review_histories.review_user_id=users.id) as Reviewer,review_histories.review_end as ReviewDate,exam_id as ExamID,user_name as StudentName,videos.duration as Duration,#Select avg(videos.duration)/60 from videos where students.exam_id=exams.id and file_type in (10,11) as AvgDuration
student_file_types.code as 'Video Type'
from review_histories
left join users on review_histories.review_user_id=users.id
left join students on review_histories.student_id=students.id
left join exams on students.exam_id=exams.id
left join student_files on student_files.student_id = students.id
left join student_file_types on student_file_types.id=student_files.file_type
left join videos on videos.id = student_files.video_id
where {{enddate}} and users.first_name LIKE CONCAT('%',{{name}},'%') or {{enddate}} and users.last_name LIKE CONCAT('%','%') or {{enddate}} and RTRIM(LTRIM(CONCAT(COALESCE(users.first_name),COALESCE(" "),COALESCE(users.last_name)))) LIKE CONCAT('%','%') and users.id = review_histories.review_user_id and review_histories.review_flag <> false and student_file_types.code = 'webrtc_video'
order by ReviewDate asc
[当前结果]
审稿人 | 审核日期 | exam_ID | 学生姓名 | 持续时间 | 视频类型 |
---|---|---|---|---|---|
迈克尔·E | 2021 年 5 月 11 日上午 10:15 | 1 | 杰夫A | 700 | webrtc_video |
迈克尔·E | 2021 年 5 月 11 日上午 10:15 | 1 | 杰夫A | 700 | webrtc_video |
迈克尔·E | 2021 年 5 月 11 日上午 11:15 | 1 | 鲍勃B | 600 | webrtc_video |
迈克尔·E | 2021 年 5 月 11 日上午 11:15 | 1 | 鲍勃B | 600 | webrtc_video |
迈克尔·E | 2021 年 5 月 11 日下午 12:15 | 2 | 亚历克斯 | 1,600 | webrtc_video |
[想要的结果]
审稿人 | 审核日期 | exam_ID | 学生姓名 | 持续时间 | 视频类型 |
---|---|---|---|---|---|
迈克尔·E | 2021 年 5 月 11 日上午 10:15 | 1 | 杰夫A | 1,400 | webrtc_video |
迈克尔·E | 2021 年 5 月 11 日上午 11:15 | 1 | 鲍勃B | 1,200 | webrtc_video |
迈克尔·E | 2021 年 5 月 11 日下午 12:15 | 2 | 亚历克斯 | 1,600 | webrtc_video |
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。