Du kan gøre Left Join
for det, og tjek SQLFiddle
her.
SELECT
p.*,
MATCH (title) AGAINST ('text' IN BOOLEAN MODE) AS score ,
COUNT(li.id) AS total_likes
FROM photos p
LEFT JOIN likes li
ON p.id = li.photo_id
WHERE MATCH (p.title) AGAINST ('text' IN BOOLEAN MODE)
GROUP BY
li.photo_id
ORDER BY
score , total_likes DESC