美文网首页
2022-04-08 min,max

2022-04-08 min,max

作者: 16孙一凡通工 | 来源:发表于2022-04-08 15:09 被阅读0次

    min()/max() as 求取当前字段的最大值并输出

    1890. 2020年最后一次登录

    select user_id,max(time_stamp) as last_stamp from Logins
    where time_stamp>'2020-01-01 00:00:00' and time_stamp<'2021-01-01 00:00:00'
    group by user_id;
    

    511. 游戏玩法分析 I

    select  player_id,min(event_date) as first_login
    from Activity
    group by player_id
    

    586. 订单最多的客户

    select customer_number from
    (select customer_number,count(*) as cnt
    from Orders
    group by  customer_number)t
    order by cnt desc limit 1;
    

    相关文章

      网友评论

          本文标题:2022-04-08 min,max

          本文链接:https://www.haomeiwen.com/subject/hzsysrtx.html