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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 9, 20262026-06-09T05:07:43+00:00 2026-06-09T05:07:43+00:00

How to select last date in 2 records in Mysql ? TABLE A SID

  • 0

How to select last date in 2 records in Mysql ?

TABLE A

SID NAME Sex
1  Jam  M
2  Da   F

TABLE B

 ID Title SID Date
   1  A     1   2012-07-31 09:57:10
   2  NULL  1   2012-07-31 09:57:13
   3  A     2   2012-07-31 10:10:13
   4  NULL  2   2012-07-31 10:57:13

I want to inner join those two tables,

but select only one record only of Table B(distinct of SID) where title not null then show the

biggest Date of title is null field.

Result want the biggest Date of Null title:

ID Name Title SID  Date
1  Jam  A     1    **2012-07-31 09:57:13**
2  DA   A     2    **2012-07-31 10:57:13**

How to do that ?

  • 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-09T05:07:45+00:00Added an answer on June 9, 2026 at 5:07 am
    SELECT b.ID, a.NAME, b.Title, b.SID, b.Datea 
    from tablea a left outer join 
      (( SELECT sid, MAX(datea) AS latest
             FROM tableb
              where title is not null 
              GROUP BY sid) AS dt
    INNER JOIN tableb b  ON b.sid= dt.sid  and b.datea=dt.latest )
    on a.sid=b.sid
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

How can I SELECT the last row in a MySQL table? I'm INSERTING data
I am trying to select the last record from a table in MySQL using
How to get last 3 months records from the table. SELECT * from table
I'm trying to come up with a MySQL query to select the last record
I want to copy an existing MySQL table over to a duplicate table, but
I have a datetime field in my MySql table where the date and time
I have a MySQL table: myTable {Int id, Int value, Date date} I wish
how to fetch the last inserted (datetime) records for each category in database table
I have a time/date field in my select query and I want to set
I'm currently having more than 400k records in my mysql table. The structure is

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.