xbackend/sql/留存2.sql
2021-07-09 16:55:45 +08:00

17 lines
876 B
SQL

select date, account, login_date,
arrayMap((x,y)->x,account,login_date)
from (with groupArray(`binduid`) as account,
toDate(addHours(`#event_time`, 8)) as date
select date,
account
-- length(account) as num
from zhengba.event
where role_idx = 1
group by date) as tb_a
left join (select arrayJoin(groupArray(date)) as dd,
groupArray((date, login_account)) as login_date
from (with groupArray(distinct binduid) as login_account,
toDate(addHours(`#event_time`, 8)) as date
select date, login_account
from zhengba.event
group by date)) as tb_b on tb_a.date = tb_b.dd