Problems / Join and Dedup / Editorial
ROW_NUMBER() OVER (PARTITION BY user_id ORDER BY login_time DESC)
rn = 1
users
This is the dedup-then-join pattern. When a fact table has multiple rows per entity and you only want the latest (or earliest, or max, etc.), first deduplicate using ROW_NUMBER, then join. User 7 (grace) has no logins so doesn't appear.
Solve Join and Dedup yourself →