题解 | 每天登陆最早的用户的内容喜好
select r.log_day,r.user_id,u.hobby from ( select l.user_id user_id, date (log_time) log_day, rank() over ( partition by date (log_time) order by log_time ) as rk from login_tb l ) r left join user_action_tb u on u.user_id=r.user_id where r.rk=1
!:执行顺序
不能直接在select后面用rank() balabala as rk,然后在where子句里面用rk=1来限制
因为先执行from →where,后面才是select
上面那个样子他找不到rk,就做不下去了