Вы можете добавить LEFT JOIN
к подзапросу следующим образом:
LEFT JOIN (SELECT COUNT(p.id) num, p.boatID FROM photos p GROUP BY p.boatID)
sub_photos ON (sub_photos.boatID = Boats.id)
И затем ссылка sub_photos.num
в ваших SELECT
полях.
Это будет выглядеть примерно так:
SELECT Boats.id, Boats.date, Boats.section, Boats.raft,
river_company.company, river_section.section AS river,
sub_photos.num AS number_of_photos
FROM Boats
INNER JOIN river_company ON Boats.raft = river_company.id
INNER JOIN river_section ON Boats.section = river_section.id
LEFT JOIN (SELECT COUNT(p.id) num, p.boatID FROM photos p GROUP BY p.boatID)
sub_photos ON (sub_photos.boatID = Boats.id)
ORDER BY Boats.date DESC, river, river_company.company