Using SQL to get the Last Reply on a Post
- by Anraiki
I am trying to replicate a forum function by getting the last reply of a post.
For clarity, see PHPBB: there are four columns, and the last column is what I like to replicate.
I have my tables created as such:
discussion_id (primary key)
user_id
parent_id
comment
status
pubdate
I was thinking of creating a Link Table that would update for each time the post is replied to.
The link table would be as follow:
discussion_id (primary key)
last_user_id
last_user_update
However, I am hoping that theres a advance query to achieve this method. That is, grabbing each Parent Discussion, and finding the last reply in each of those Parent Discussions.
Am I right that there is such a query?