1939 Users That Actively Request Confirmation Messages

编写一个SQL查询,找出在24小时窗口内两次请求确认消息的用户ID。如果两条消息间隔正好24小时,则认为它们在窗口内。返回结果表,顺序不限。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

题目描述:
在这里插入图片描述
在这里插入图片描述
Write an SQL query to find the IDs of the users that requested a confirmation message twice within a 24-hour window. Two messages exactly 24 hours apart are considered to be within the window. The action does not affect the answer, only the request time.
Return the result table in any order.
The query result format is in the following example:
在这里插入图片描述
方法1:
主要思路:解题链接汇总

select distinct c1.user_id as user_id
from Confirmations as c1 join Confirmations as c2 on c1.user_id = c2.user_id
where c1.time_stamp<c2.time_stamp and TIMESTAMPDIFF(SECOND,c1.time_stamp,c2.time_stamp) <= 24*60*60
order by user_id
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值