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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 16, 20262026-05-16T22:53:34+00:00 2026-05-16T22:53:34+00:00

Currently I am performing a left join on two tables. The first table has

  • 0

Currently I am performing a left join on two tables. The first table has an id and a persons name, the second table has an id, the id of a person from table 1, and then a timestamp (of the last flight they had).

People                             Flights
id   |  name             id   |   person_id   | time
------------             ---------------------------
1       Dave              1         1          1284762115
2       Becky             2         1          1284787352
                          3         2          1284772629
                          4         2          1286432934
                          5         1          1289239480

When I perform my left join, I get a list of people and their flight times, but what I would like is just the list of people with their last flight times.

So SELECT p.id, p.name, f.time FROM People p LEFT JOIN Flights f ON p.id = f.person_id

Returns

1 Dave  1284762115
1 Dave  1284787352
1 Dave  1289239480
2 Becky 1284772629
2 Becky 1286432934

I would like to see just:

1 Dave  1289239480
2 Becky 1286432934

So I need to return only the match with the highest f.id or the highest f.time

  • 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-16T22:53:35+00:00Added an answer on May 16, 2026 at 10:53 pm
    SELECT
        p.id, p.name, MAX(f.time) AS LastFlight
    FROM
        People p
        LEFT JOIN Flights f ON p.id = f.person_id
    GROUP BY
        p.id, p.name
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Currently I am performing a left join on two tables. The first table has
Currently I am performing join on two tables, the result could be multiple rows.
I have some python code that currently performs expensive computation by performing the computation
Currently I have this code: <?php echo '<meta name=robots content=noindex>'; $arr = json_decode(file_get_contents(http://media1.clubpenguin.com/play/en/web_service/game_configs/ paper_items.json),true);
I've a really poorly performing piece of regex, currently it makes Firefox, Chrome and
I am performing some simulations in python that generates 1000 results. Each result has
I'm performing I/O to a single file from multiple threads. Access to this shared
I'm currently performing a curl up animation by doing the following: CATransition *animation =
I'd like to determine if a UITableView and other views are currently performing some
I'm performing matrix inversion using Householder transformations acting on an augmented matrix. Currently I

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.