select au.name, count(docs.id)
from docs
left join authors au on au.id = docs.author
group by au.name
SELECT `a`.`name`, IFNULL(`d`.`count`, 0) AS `count`
FROM `authors` AS `a`
LEFT JOIN (
SELECT `author`, COUNT(*) AS `count`
FROM `docs`
GROUP BY `author`
) AS `d` ON `d`.`author` = `a`.`id`
UNION (SELECT CONCAT('Неизвестный ', IFNULL(`d`.`author`, '')), `d`.`count`
FROM `authors` AS `a`
RIGHT JOIN (
SELECT `author`, COUNT(*) AS `count`
FROM `docs`
GROUP BY `author`
) AS `d` ON `d`.`author` = `a`.`id`
WHERE `a`.`id` IS NULL)
ORDER BY `count` DESC