#简单的判断思路解题,排序判断uid排名第一的登录的时间,再利用case进行判断
with tiaojian as (
select 
uid,
date(in_time) as day
from tb_user_log
group by uid,day
union all
select
uid,
date(out_time) as day
from tb_user_log
group by uid,day
)

select
day,
count(distinct uid) as dau,
round(
count(distinct case when m=1 then uid end)/count(distinct uid),2) as
uv_new_ratio 
from(
select 
uid,
day,
row_number()over(partition by uid order by day ) as m
from tiaojian
) as t 
group by day
order by day