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

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

全部评论

相关推荐

看起来名字可以很长:笑死 我暑期实习阿里云的意向也被 qq 邮箱放在垃圾箱了
点赞 评论 收藏
分享
评论
点赞
收藏
分享

创作者周榜

更多
牛客网
牛客网在线编程
牛客网题解
牛客企业服务