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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 17, 20262026-06-17T22:36:47+00:00 2026-06-17T22:36:47+00:00

I have the following data: id date_modified value 1 some_date 4 1 some_date 3

  • 0

I have the following data:

id   date_modified   value
1    some_date       4
1    some_date       3
1    some_date       1
2    some_date       5
3    some_date       8
3    some_date       7
...

and this query gets the id and date_modified where date_modified is the latest date:

select bh.id, max(bh.date_modified) 
from my_table bh
group by bh.id;

which does this:

id   date_modified  
1    some_date       
2    some_date       
3    some_date       
...

where each date is the latest date for each id which is nearly what I want.

How do I change the group by to get the value out? It’s the value that I’m interested in but I need to group using the id.

Many thanks.

  • 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-17T22:36:49+00:00Added an answer on June 17, 2026 at 10:36 pm

    Try this:

    SELECT id, date_modified, value
    FROM
    (
        SELECT
            id, date_modified, value, ROW_NUMBER() OVER (PARTITIOn BY Id ORDER BY date_modified DESC) RN
        FROM tbl
    ) A
    WHERE RN = 1
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have the following data | Item | Value | Date | ------------------------------ |
I have the following data being returned from a query. Essentially I am putting
So, I have got following data in a MySQL table: mysql> SELECT * FROM
So I have the following data-structure coming back from my server. {date:'2/1', name: 'product
Say we have the following simple data-frame of date-value pairs, where some dates are
I have the following data frame. date id value 2012-01-01 1 0.3 2012-01-01 2
I have the following data in a database table, Columns : Date, Hour(from 1
I have the following data set structure: date time_in_hours price Sep 03 08 9.76
I have following data frames > head(elo) date elo 1 1921-12-18 1597 2 1922-05-14
I have the following data on a table tbl Admission : Date and Time

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.