You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
select player_id, min(event_date) as first_login from activity
group by player_id;
解析
按照 player_id 将 activity 分组
使用 min 函数,求出日期的最小值
SQL:方法二
select player_id, event_date as first_login from (
select
player_id,
event_date,
dense_rank()
over(partition by player_id order by event_date) as 排名
from activity
) as temp where 排名 =1;
题目
获取每位玩家第一次登录平台的日期
SQL:方法一
解析
player_id
将activity
分组min
函数,求出日期的最小值SQL:方法二
解析
dense_rank
函数按照player_id
和event_date
进行排序,并算出排名将其作为临时表temp
temp
,筛选出排名 = 1
数据The text was updated successfully, but these errors were encountered: