WITH bookOrder AS ( SELECT name, title, num , ROW_NUMBER() OVER (PARTITION BY name ORDER BY num DESC) AS rank FROM book ) SELECT * FROM bookOrder WHERE rank <= 5