SELECT * FROM tasks
JOIN photos
ON tasks.id=photos.task_id
WHERE task_id=1;id title id task_id path
1 First task 1 1 photos/1.jpg
1 First task 2 1 photos/2.jpg

чем больше человек просмотрело страницу