select
    t.login_date as dt,
    count(t.uid) as total_user_num,
    concat (
        round(sum(is_new) * 100 / count(t.uid), 1),
        '%'
    ) as new_user_rate
from
    (
        select
            distinct u.uid,
            u.login_date,
            if (u.login_date = f.first_date, 1, 0) as is_new
        from
            user_login_tb u
            left join (
                select
                   distinct  uid,
                    min(login_date) as first_date
                from
                    user_login_tb
                group by
                    uid
            ) f on u.uid = f.uid
    ) t
group by
    dt
order by
    dt;