题解 | #根据指定记录是否存在输出不同情况#

根据指定记录是否存在输出不同情况

https://www.nowcoder.com/practice/f72d3fc27dc14f3aae76ee9823ccca6b

with a as
(
select uid,level,sum(case when start_time is not null and submit_time is null then 1 else 0 end) as incomplete_cnt,count(start_time) as cnt,ifnull(round(sum(case when start_time is not null and submit_time is null then 1 else 0 end)/count(start_time),3),0)  as incomplete_rate
from exam_record
right join user_info
using (uid)
group by uid
)
select uid,incomplete_cnt,incomplete_rate from a
where exists
(select uid from a
where incomplete_cnt>2 and level=0) and level=0 
union all
select uid,incomplete_cnt,incomplete_rate from a
where not exists
(select uid from a
where incomplete_cnt>2 and level=0)
and cnt>0
order by incomplete_rate

全部评论

相关推荐

05-30 13:04
已编辑
门头沟学院 算法工程师
智谱和米哈游都是ai大模型agent的业务钱的话还是米更多,几乎翻倍了,有没有老哥是两个公司其中一个的,能问问转正率咋样嘛,我问的hr回答都是做的好就可以转正暑期实习
码农索隆:选米哈游:短期高薪、敢承担风险、具备强创新能力,且愿押注游戏AI赛道。 选智谱:稳定性与行业通用能力积累,接受薪资差距以换取更稳妥的职业基础。
投递北京智谱华章科技等公司7个岗位 > 实习期间如何提升留用概率?
点赞 评论 收藏
分享
嵌入式小辣鸡:包装好一点,校内的奖项可以不用写,校内项目经历最后两点写的太差了,详细讲一下内容,名字变一下。只需要写项目实现了什么,自己在其中做了什么就好,查看图片
点赞 评论 收藏
分享
点赞 评论 收藏
分享
评论
点赞
收藏
分享

创作者周榜

更多
牛客网
牛客企业服务