select
t.login_date as dt,
count(distinct uid) as total_user_num,
concat(
ifnull(
round(
(
sum(case when t.m=1 then 1 end)/count(distinct uid))*100,1),0),"%") as new_user_rate
from(
select 
login_date,
uid,
row_number()over(partition by uid order by login_date) as m 
from user_login_tb
) as t 
group by t.login_date