Hi, members,
I'm working on simple forum and I can't make one query.
I want to show on homepage list of topics where will be the author of the topic and author of last post.
I can make any of them but not together, because there is double inner join to one table (one for topic author and second for last post's author).
Tables (just with necesary parts):
Topics
######
id
author_id (will be connected directly to Users.id)
last_post_id (will be connected to Posts.id)
Posts
#####
id
author_id (connected to Users.id)
Users
#####
id
name
I can start with this and I don't know how to continue:
Code:
SELECT topics.author_id, topics.last_post_id, users.name,
FROM topics
INNER JOIN users ON topics.author_id = users.id
It will give back topic's names, their authors and ID of last post. And I want to know last post's author's name.
Can anyone help, please?
Thanks for any response
