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

牛客直播各科目出勤率

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;

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

全部评论

相关推荐

夏目LTH:这个真的很看运气,多投吧。我从去年十二月底一直投到现在,之前没一个offer,结果两周前投的一家面试官聊的特别好,直接速通offer还给的SP待遇开的比我期望都够。
我的求职进度条
点赞 评论 收藏
分享
评论
点赞
收藏
分享

创作者周榜

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