select dt,count(*) as dau, round(sum(new_in = dt)/count(*),2) as uv_new_ratio from (select uid,date(in_time) as dt from tb_user_log union select uid,date(out_time) as dt from tb_user_log)a join(select uid,min(date(in_time))as new_in from tb_user_log group by uid)b using (uid) group by dt order by dt
算逻辑表达式时不要习惯性用count