直接上sql
// datetime存储的是时间戳类型
select
FROM_UNIXTIME(time, '%Y-%m-%d') as day,
app_id,
count( DISTINCT id ) AS count
from login_time
where
DATE_FORMAT(time, '%Y-%m-%d') >'2020-03-01'
GROUP BY day,app_id
// datetime存储的是【2019-12-16 03:36:25】类型
select
DATE_FORMAT(time, '%Y-%m-%d') as day,
count( DISTINCT id ) AS count
from login_time
where
DATE_FORMAT(time, '%Y-%m-%d') >'2020-03-01'
GROUP BY day