Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6995623
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T20:03:12+00:00 2026-05-27T20:03:12+00:00

I have tables for a forum system. I am tring to get the following

  • 0

I have tables for a forum system. I am tring to get the following data to show on the forum page
Subject, Descripton, Last Posting Date (either post or comment), and username who made last post(either post or comment)

here are my tables

ForumSubject[
   Id,
   Subject,
   Description
 ]


ForumPost[
   id,
   Subject,
   Title
   Body,
   UserId,
   Date
 ]

ForumComment[
   id,
   PostId,
   UserId,
   Date,
   Comment

 ]

 User[
    id
    Name
  ]

Here is what i have so far

SELECT
subject.Id,
subject.Description,
subject.Subject
FROM dbo.ForumSubject subject

How now can I get the MAX Date of either a post or comment which ever is last, and the user name for the post???

Thank you!

  • 1 1 Answer
  • 1 View
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-27T20:03:13+00:00Added an answer on May 27, 2026 at 8:03 pm

    You can do that :

       SELECT s.Id, s.Subject, s.Description, t2.LastDate
       FROM dbo.FormSubjet s
       INNER JOIN (
        SELECT Id, Max(Date) as LastDate
        FROM (
            SELECT Id, Date
            FROM dbo.FormPost
            UNION ALL
            SELECT Id, Date
            FROM dbo.FormComment
        ) t1
        GROUP BY t1.Id      
        ) t2 ON t2.Id = s.Id
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have two tables, one is a table of forum threads. It has a
Ok, here's the condensed form. I have three main tables to draw data from:
I have a vb.net 2010 form with 22 data bound controls from two tables
I am doing a system that imports live data from Fusion tables. I am
I have a PostGreSQL database with the following data model: CREATE TABLE staff (s_id
I have a simple page for a chat system. Test page can be found
I have a coupon system, and I'm trying to get the coupon object with
Using PHP and MySQL, I have a forum system I'm trying to build. What
I am trying to build a data management system online using mysql/php/javascript/etc. I have
I have two tables - forum_topics and topics_posts . I want to select rows

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.