YYYYMMDDHHSS 最近的时间轴更新
YYYYMMDDHHSS

YYYYMMDDHHSS

V2EX 第 507309 号会员,加入于 2020-09-09 13:31:21 +08:00
YYYYMMDDHHSS 最近回复了
2023-03-02 17:40:33 +08:00
回复了 killva4624 创建的主题 MySQL 如何按天统计前 7 天周活?
with data as (

select '2023-01-01' as dt ,'UserA' as user_name union all
select '2023-01-01' as dt ,'UserB' as user_name union all
select '2023-01-02' as dt ,'UserA' as user_name union all
select '2023-01-03' as dt ,'UserC' as user_name union all
select '2023-01-04' as dt ,'UserA' as user_name union all
select '2023-01-05' as dt ,'UserB' as user_name union all
select '2023-01-06' as dt ,'UserA' as user_name union all
select '2023-01-07' as dt ,'UserC' as user_name union all
select '2023-01-09' as dt ,'UserA' as user_name union all
select '2023-01-10' as dt ,'UserB' as user_name union all
select '2023-01-11' as dt ,'UserA' as user_name union all
select '2023-01-12' as dt ,'UserC' as user_name union all
select '2023-01-13' as dt ,'UserA' as user_name union all
select '2023-01-14' as dt ,'UserB' as user_name union all
select '2023-01-15' as dt ,'UserA' as user_name union all
select '2023-01-16' as dt ,'UserC' as user_name union all
select '2023-01-17' as dt ,'UserA' as user_name union all
select '2023-01-18' as dt ,'UserB' as user_name
)
select
t.dt,
date_add(t.dt, 7) dt_to,
count(distinct t.user_name) as cnt
from
(
select
d1.dt,
d2.user_name
from
data d1
join data d2
where
1 = 1
--and d1.dt > d2.dt
and datediff(d1.dt, d2.dt) <= 7
) t
group by
dt
----

大数据量不建议这样做
2021-02-23 08:44:50 +08:00
回复了 zhuzhibin 创建的主题 生活 [!]钥匙忘记带了,找人开锁,1 分钟结束 50 块没了
我这开锁 100,兄弟
买个发胶自己修修
2021-02-19 13:09:08 +08:00
回复了 Touchevent 创建的主题 问与答 开朗的性格需要什么来支撑?
快乐的童年
2021-02-08 11:29:11 +08:00
回复了 theqiang 创建的主题 生活 双方父母不能支持买房的打工人该何去何从
@rylei 不过是望山跑死马
2021-02-01 13:19:02 +08:00
回复了 hjosama 创建的主题 程序员 女装大佬求职问题
扎辫子不就得了
2021-01-18 09:22:14 +08:00
回复了 polyang 创建的主题 程序员 在外包呆久了真的很可怕,感觉我快要废了
技术大神也是靠时间钻研的,讲道理对于大多数精力有限的人来说到底学习本身是不会带来快乐的,回报才能。
2021-01-15 11:26:33 +08:00
回复了 captain2011 创建的主题 职场话题 女生觉得国企工作太压抑了,想跳出来
如果是海外客服可是要上夜班的
语雀
关于   ·   帮助文档   ·   博客   ·   API   ·   FAQ   ·   实用小工具   ·   5511 人在线   最高记录 6679   ·     Select Language
创意工作者们的社区
World is powered by solitude
VERSION: 3.9.8.5 · 22ms · UTC 08:23 · PVG 16:23 · LAX 00:23 · JFK 03:23
Developed with CodeLauncher
♥ Do have faith in what you're doing.