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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 20, 20262026-05-20T16:01:33+00:00 2026-05-20T16:01:33+00:00

I am having following table structure and having the following Data in this table

  • 0

I am having following table structure
enter image description here
and having the following Data in this table
enter image description here
Now I want to query in such a way so that I can have values of all the columns + the value of max(currenttime) for a particular game_id.

i am running the following query
SELECT _id, game_id, inning_id, scoretype, oponentonescore, oponenttwoscore, currenttime, MAX( currenttime ) AS latest FROM game_scores WHERE game_id = ‘2268’

and as a result i am getting only one row as in the following result
enter image description here
But i want want all rows matching the criteria(i.e. game id 2268)

How to compose Query to achieve this?

Thanks in advance

  • 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-05-20T16:01:33+00:00Added an answer on May 20, 2026 at 4:01 pm

    i’m sorry, i haven’t actually tested this, but maybe something like this would do the trick:

    SELECT
        _id,
        game_id,
        inning_id,
        scoretype,
        oponentonescore,
        oponenttwoscore,
        currenttime,
        latest
    FROM
        game_scores
    JOIN (
        SELECT
            MAX(currenttime) AS latest
        FROM
            game_scores
        WHERE
            game_id = '2268'
    ) AS latest_calculation
    WHERE game_id = '2268';
    

    although this solution is heavier on the database than it is heavy on the application to figure it out after the query is back from the database (like alex suggested).

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have the following table structure and I want a turn the query into
I have the following query: select column_name, count(column_name) from table group by column_name having
I have a data structure similar to the following picture. Table A has_many Table
I have created a table in MSSQL having following structure - **Table Name -
Hello friends I am having following table structure of quote Table I want to
I have the following code: SELECT <column>, count(*) FROM <table> GROUP BY <column> HAVING
I'm having an issue bending my head around this one. I have a table
I have two tables Product having following structure: ProductID,ProductName, IsSaleTypeA, IsSaleTypeB, IsSaleTypeC 1, AAA,
I'm wondering what Data Structure people would recommend to do the following. I have
I have the following data being returned from my database query: +---------------+-----------+------------------+--------------+-------+ | district_name

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.