题解 | #任意两个连续自然月练题次数大于1的用户#

任意两个连续自然月练题次数大于1的用户

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

with cte as(
select device_id,date_format(event_date,'%Y%m') as event_month,count(*) as num
from question_practice_detail
group by device_id,event_month ),
cte1 as (
select a.device_id,a.num+b.num as cnt
from cte a left join cte b on a.device_id=b.device_id and period_diff(a.event_month,b.event_month)=1
where b.event_month is not null )
select device_id
from cte1
group by  device_id
having min(cnt)>1
order by device_id desc

全部评论

相关推荐

07-02 10:44
门头沟学院 C++
码农索隆:太实诚了,告诉hr,你能实习至少6个月
点赞 评论 收藏
分享
机械打工仔:有说的你怀疑一下就行了,直接问也太实诚了
点赞 评论 收藏
分享
05-29 22:11
门头沟学院 Java
Elastic90:抛开学历造假不谈,这公司的招聘需求也挺怪的,Java开发还要求你有图文识别、移动端开发和c++的经验,有点逆天了。
点赞 评论 收藏
分享
评论
点赞
收藏
分享

创作者周榜

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