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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T23:28:09+00:00 2026-05-27T23:28:09+00:00

hopefully there is a simple resolution to my challenge. I have a parent table

  • 0

hopefully there is a simple resolution to my challenge.

I have a parent table I will call table ‘A’ and a child table called table ‘B’. I would
like to get information from the most recent row in table ‘B’ for a given row in table
‘A’.

For example… parent 12345 in Table ‘A’ has three child rows in table ‘B’. Row number
3 is the most recent row in table ‘B’ for parent 12345. I would like to get row 3’s
information.

I tried quite a few different approaches and could not get it to do what is needed, hence my posting this here.

Thank you 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-27T23:28:09+00:00Added an answer on May 27, 2026 at 11:28 pm

    Use an INNER JOIN on the two tables, relating them by the child id to the parent’s child id:

    SELECT b.*
    FROM Table_B b INNER JOIN Table_A a
    ON b.id = a.Table_B_id 
    WHERE a.id = 42
    ORDER BY b.id DESC
    LIMIT 1
    

    I was going to suggest:

    SELECT * FROM Table_B WHERE id IN (
        SELECT Table_B_id FROM Table_A ORDER BY id DESC LIMIT 1
    )
    

    But apparently MySQL doesn’t support LIMIT on an inner select.

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

Sidebar

Related Questions

I have a simple question, and hopefully there is a simple answer . .
I have a simple (hopefully) scenario. Seats table Computers table SeatComputers table (since a
Now there is a subject that could be taken many ways. Hopefully I will
Hopefully this is a silly question and there's really a simple solution somewhere out
This is hopefully a very simple maths question. If I have two number ranges,
Hopefully two simple questions relating to creating a server application: Is there a theoretical/practical
Is there a simple way to replace commas with tabs in Textmate, hopefully using
Hopefully a basic question: Is there a simple way to change the speed with
Simple one hopefully, is there a way I can use strtolower and str_replace together.
Hopefully this is a simple request. I found this code that will work perfectly

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.