题解 | #牛客直播各科目出勤率#

牛客直播各科目出勤率

https://www.nowcoder.com/practice/0cab547df4f0430b93042128f445d899

select course_id, course_name, round(chuqing * 100 / zong, 2) as 'attend_rate(%)'
from (
    select count(distinct user_id) as chuqing, course_id
    from attend_tb
    where timestampdiff(minute, in_datetime, out_datetime) >= 10
    group by course_id
) a join (
    select count(distinct user_id) as zong, course_id
    from behavior_tb
    where if_sign = 1
    group by course_id
) b using(course_id)
right join course_tb using(course_id)
group by course_id, course_name
order by course_id

全部评论

相关推荐

每晚夜里独自颤抖:要求太多的没必要理
点赞 评论 收藏
分享
评论
点赞
收藏
分享

创作者周榜

更多
牛客网
牛客网在线编程
牛客网题解
牛客企业服务