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

牛客直播各科目出勤率

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

select 
t3.course_id as course_id
,m.course_name as course_name
,round(t3.attend_rate*100,2) as attend_rate
from(select 
t1.course_id,t2.nnt/t1.amt as attend_rate
from 
(select 
course_id
,sum(if_sign) as amt
from behavior_tb
group by course_id) t1
left join 
(select 
course_id
,count(distinct user_id) as nnt
from attend_tb
where timestampdiff(minute,in_datetime,out_datetime)>=10
group by course_id 
)t2
on t1.course_id=t2.course_id) as t3
left join course_tb m
on t3.course_id=m.course_id
group by t3.course_id,m.course_name;

这个分数没办法一起写出来的话,就分子分母分开写

全部评论

相关推荐

06-23 17:45
门头沟学院 Java
里面的项目啥的真的有用吗? 这些人是割韭菜吗?
HellowordX:很简单,如果你有自己稳定的学习路线和获取知识的方式就没必要,如果你啥都不懂的小白或者里边有你感兴趣的知识,我觉得挺值,我也经常为知识付费,因为时间精力有限,很多东西我不可能自己重复造轮子
点赞 评论 收藏
分享
点赞 评论 收藏
分享
评论
点赞
收藏
分享

创作者周榜

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