Q&A for students, teachers, polyglots, and anyone interested in the techniques of second-language acquisition
WITH ranked_posts AS ( SELECT p.OwnerUserId, p.Id, p.ViewCount, RANK() OVER (PARTITION BY p.OwnerUserId ORDER BY p.ViewCount DESC) AS rank FROM posts p ) SELECT OwnerUserId, Id, ViewCount FROM ranked_posts WHERE rank = 1 ORDER BY OwnerUserId;