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 7748565
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 1, 20262026-06-01T10:49:06+00:00 2026-06-01T10:49:06+00:00

Running a query which should return all open questions along with the last update

  • 0

Running a query which should return all open questions along with the last update time they were updated.

The way this works is a question is inserted into the Question table, and updates / answers are inserted to qUpdate table with a foreign key of the original question to associate them.

This is the query I’ve written at the moment however it’s not quite what I want:

SELECT MAX (qUpdate.UpdateTime) AS LastUpdateTime, Question.ID FROM Question
LEFT JOIN qUpdate ON qID = qUpdate.qID WHERE Status = 'open'GROUP BY Question.ID, Question.Status;

The result:

     lastupdatetime     id
    2012-12-21 20:37:00;7
    2012-12-21 20:37:00;10
    2012-12-21 20:37:00;1000
    2012-12-21 20:37:00;5
    2012-12-21 20:37:00;2
    2012-12-21 20:37:00;9

As you can see it returns the latest update for all of the questions as oppose to the latest update for each of the questions. I understand why but I’m not sure how to solve this issue.

Sorry I was a bit ambiguous in my explanation..

Basically:

At present it returns the last update time regardless of what the update time of a particular question is i.e. it finds the maximum last update time for all of them and returns it for all the questions that are open…

What I’d like it to do is list all of the open questions as well as the last update time for that particular ticket.

Im using Postgresql

  • 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-01T10:49:07+00:00Added an answer on June 1, 2026 at 10:49 am

    Looks like this is is your problem:

    LEFT JOIN qUpdate ON qID = qUpdate.qID
    

    Should be this:

    LEFT JOIN qUpdate ON qID = Question.ID
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am running oracle and have a query which pulls some results from the
I have the following mysql query which I am running with php like so.
I'm running a batch file command on a server which is using reg query
I've written a program which should query the Terminal Services API and print out
I am running a hibernate query which is returning an Object instead of the
I'm running the following query on my database, which generates a sql query I
Im making a system which should be running 24/7, with timers to control it.
Im running this query on the same server as the web application, so SPQuery.ExpandRecurrence
I am running a query against a providex database that we use in MAS
I'm running a query against a table in a postgresql database. The database is

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.