题解 | #未完成试卷数大于1的有效用户#{重点}

未完成试卷数大于1的有效用户

https://www.nowcoder.com/practice/46cb7a33f7204f3ba7f6536d2fc04286

select uid,
count(case when score is null then  1 end) incomplete_cnt,
count(case when score is not null then 1 end) complete_cnt,
group_concat(distinct concat_ws(':',DATE_FORMAT(start_time,'%Y-%m-%d'),tag) separator ';') detail
from exam_record a
left join examination_info b
on a.exam_id=b.exam_id
where YEAR(start_time)=2021
group by uid
having count(case when score is not null then 1 end)>=1
and count(case when score is  null then 1 end)<5
and count(case when score is null then 1 end)>1
order by count(case when score is not null then 1 end) desc



Group concat用法
Group_concat(distinct c order  by desc separator ‘:’)


concat_ws 用法
写一次分隔符号,完成全部

concat_ws(‘:’,tag,tag2,...n)
第一个是操作符号,后面是需要链接的各个部分
全部评论

相关推荐

06-23 11:43
门头沟学院 Java
allin校招的烤冷...:我靠,今天中午我也是这个hr隔一个星期发消息给我。问的问题还是一模一样的😅
点赞 评论 收藏
分享
每晚夜里独自颤抖:你cet6就cet6,cet4就cet4,你写个cet证书等是什么意思。专业技能快赶上项目行数,你做的这2个项目哪里能提现你有这么多技能呢
点赞 评论 收藏
分享
找到实习了&nbsp;给了150一天&nbsp;但是说是低代码&nbsp;值得去吗
码农索隆:是在没实习,可去,待个一两周,不行就润呗
点赞 评论 收藏
分享
评论
点赞
收藏
分享

创作者周榜

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