题解 | 每天登陆最早的用户的内容喜好

select
    date_format (l.log_time, '%Y-%m-%d') as log_day,
    l.user_id as user_id,
    hobby
from
    login_tb l,
    user_action_tb u,
    (
        select
            date_format (log_time, '%Y-%m-%d') as log_day,
            min(log_time) as log_time
        from
            login_tb
        group by
            log_day
    ) a
where
    l.user_id = u.user_id
    and l.log_time = a.log_time
    and date_format (l.log_time, '%Y-%m-%d') = a.log_day

全部评论

相关推荐

牛客10001:问就是六个月,全国可飞,给钱就干
点赞 评论 收藏
分享
评论
点赞
收藏
分享

创作者周榜

更多
牛客网
牛客企业服务