SELECT `a`.`name` AS `author_name`, `b`.`name` AS `book_name`
FROM (
SELECT `author_id`, `name`,
ROW_NUMBER() OVER (PARTITION BY `author_id` ORDER BY `id` DESC) AS `row`
FROM `books`
) AS `b`
JOIN `authors` AS `a`
ON `b`.`row` < 6 AND `a`.`id` = `b`.`author_id`
WHERE `a`.`id` IN (список id)
ORDER BY `a`.`name`, `b`.`name`