select log_day,user_id,hobby from (select left(log_time,10) log_day,lt.user_id,hobby,rank()over(partition by left(log_time,10) order by log_time) first_user from login_tb lt join user_action_tb uat on lt.user_id=uat.user_id ) As A where first_user=1
ROW_number | 为每行分配唯一的数字 | 1, 2, 3, 4, … |
RANK | 相同的值共享相同的排名,排名会跳过数字 | 1, 1, 3, 4, … |
DENSE_RANK | 相同的值共享相同的排名,不跳过数字 | 1, 1, 2, 3, … |
rank会并列且跳过,dense rank会并列,但不跳过,row number 正常排序