I have a database called "forum" with the tables:
- "users", containing: user_id, username, password
- "posts", containing: post_id, user_id (FK from "users"), type, title, content
- "comments", containing: comment_id, user_id (FK from "users"), post_id (FK from posts"), content
At the moment, i'm using the query:
SELECT *
FROM forum.comments
JOIN forum.posts ON (comments.post_id = posts.post_id)
JOIN forum.users ON (posts.user_id= users.user_id)
With this query i can only display the username of the person who made the post, not the comment. How can i change this to show who made the comment, AND who made the post in the same query?
(If someething in the query is written wrong, it's just cause i had to translate it from another language, the query does return results).