Have an article model, each article has an author and publisher (both are tables). A user can follow authors and publishers.
User -> Follow -> Author or Publisher -> Article
I want to find all the articles by the authors and publishers they are following.
SELECT articles.*, articles2.* FROM follows
INNER JOIN articles ON follows.author_id = articles.author_id
INNER JOIN articles AS articles2 ON follows.publisher_id = articles2.publisher_id
WHERE follows.user_id = 1
Can I get all the articles into 1 query? If so how? If not can I combine two queries and then order them?
1 Answer