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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 14, 20262026-06-14T23:22:11+00:00 2026-06-14T23:22:11+00:00

I got a table like this Measurements id object_id generated_at (v) 110 4 2012-11-13

  • 0

I got a table like this

Measurements

id    object_id   generated_at (v)    
110   4           2012-11-13 10:29:00   
109   4           2012-11-13 10:28:00   
108   4           2012-11-13 10:27:00
107   3           2012-11-13 10:26:00
106   3           2012-11-13 10:25:00
105   4           2012-11-13 10:24:00
104   4           2012-11-13 10:23:00
103   1           2012-11-13 10:22:00
102   1           2012-11-13 10:21:00
...

ordered by generated_at column.

My question: is there any ability to select

id    object_id   generated_at (v)    
110   4           2012-11-13 10:29:00   
109   4           2012-11-13 10:28:00   
108   4           2012-11-13 10:27:00

last group(ordered by generated_at) of measurements with same object_id ?

It could be example in rails for Measurement model or just SQL query, thanks for any help!

  • 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-14T23:22:12+00:00Added an answer on June 14, 2026 at 11:22 pm

    You original question clearly wanted the objects in the most recent groups, not all objects. For this, you need to calculate both the max object id and the maximum generated time for other objects:

    select *
    from t cross join
         (select max(object_id) maxobject_id from t) maxt
    where object_id = maxt.maxobject_id and
          generated_at > (select max(generated_at) from t where object_id <> maxt.maxobject_id)
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I got a table like this, and use MYSQL 5.5 id --- 2 3
I've got table with two columns: name and grade. It looks sth like this:
I've basically got a table with 2 rows and it looks like this: ---------
I'm relatively confused about this... I've got a table like: +----------------+--------------------------------------------------+------+-----+-------------------+-----------------------------+ | Field |
I've got a situation like this: Table: FunTable ItemKey ItemName ItemPriceEffectiveDate ItemPrice 11 ItemA
So I've got this audit table, looks like this: USE [DatabaseName] GO /****** Object:
I've got m2m relationship like this: #main table CREATE TABLE products_product ( id integer
I've got a query that looks something like this: SELECT * FROM table WHERE
I’ve got a table like this: Create Table PersonAgent ( PersonID varchar2(10) not null,
Let's say you've got a table like this: ID Cat1 Cat2 1 a red

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.