SELECT feed.*, posts.title FROM feed LEFT JOIN posts ON feed.entityId = posts.id WHERE feed.entityType = "posts"
SELECT feed.*, photos.title FROM feed LEFT JOIN photos ON feed.entityId = photos.id WHERE feed.entityType = "photos"
SELECT feed.*, comments.title FROM feed LEFT JOIN comments ON feed.entityId = comments.id WHERE feed.entityType = "comments"
SELECT feed.*, users.title FROM feed LEFT JOIN users ON feed.entityId = users.id WHERE feed.entityType = "users"