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

  • Home
  • SEARCH
  • 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 8301377
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 8, 20262026-06-08T16:55:15+00:00 2026-06-08T16:55:15+00:00

I have this query which grabs the max date record for three different tables.

  • 0

I have this query which grabs the max date record for three different tables. I can do a union on these tables to have them all return their respective dates together. However I am having trouble finding a way to select the max of these three records that are returned. Any ideas?

SELECT MAX (Date_submitted ) as a
FROM [AngelSQL] . [dbo]. [LSN_RESPONSES] , ACCOUNTS , LSN_ENTRIES , GB3_ASSOCIATIONS
where
LSN_RESPONSES . USER_ID = accounts . username
and LoginName = 'admin'
and TakenFromCourseId = 'TT-TC-TS-TD-Test-Test'
and LSN_RESPONSES . PARENT_ID = LSN_ENTRIES .ENTRY_ID
and LSN_RESPONSES . PARENT_ID = GB3_ASSOCIATIONS .LSN_ENTRY_ID
union
SELECT MAX ( dateEnd ) as a
FROM [AngelSQL] . [dbo]. [qti_assessment_attempt] ,dbo . ACCOUNTS, COURSES, qti_question_containers, GB3_ASSOCIATIONS
where   accounts . PERSON_ID = qti_assessment_attempt .person_id
and
taken_from_course_container_id = courses. CONTAINER_ID
and
accounts .LoginName = 'admin'
and COURSES . COURSE_ID= 'TT-TC-TS-TD-Test-Test'
and qti_assessment_attempt . question_container_id = qti_question_containers. id
and qti_question_containers . entry_ID = GB3_ASSOCIATIONS .LSN_ENTRY_ID
union
SELECT MAX ( PostDate ) as a
FROM dbo . ACCOUNTS, DiscussionPost , DiscussionForum , GB3_ASSOCIATIONS
where
accounts .USERNAME = DiscussionPost. AuthorId
and
LoginName ='admin'
and
discussionpost . CourseContext = 'TT-TC-TS-TD-Test-Test'
and
DiscussionPost . ForumId = DiscussionForum .ForumId
and DiscussionForum . EntryId = GB3_ASSOCIATIONS .LSN_ENTRY_ID}
  • 1 1 Answer
  • 0 Views
  • 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-06-08T16:55:19+00:00Added an answer on June 8, 2026 at 4:55 pm

    Use your query as a subquery/CTE, like this:

    with t as (<put your query here>)
    select max(a)
    from t
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have this query which groups the results by ORDER#. SELECT ORDER#, MAX(SHIPDATE -
I have this query which returns a result set with Date(column) as nvarchar datatype.
I need some help formulating this query. I have two (relevant) tables, which I
I have this query which on executing in my sql command line client executes
I have this query which is a dependant query and taking much execution time
I have this query which works correctly in MySQL. More background on it here
Right now I have this SQL query which is valid but always times out:
I have this query, which is giving me some problems... I am trying to
I have this query. It matches anything which has South in its name. But
in my self-defined module I have this method which will query the db and

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.