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

The Archive Base Latest Questions

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

.what i want to do is to retrieve records from my database and display

  • 0

.what i want to do is to retrieve records from my database and display everything but the condition is not to display all records having the same task_id but to display only the newest among them. how do I select the newest among the records with the same task_id?

  • 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-23T04:34:54+00:00Added an answer on May 23, 2026 at 4:34 am

    You will need a column like

    last_modified TIMESTAMP
    

    so each time a row is inserted, or updated, the last_modified column gets updated with the current timestamp. Then, all you need is a query like

    SELECT *
      FROM tblTask
     WHERE task_id = n
     ORDER BY last_modified DESC
     LIMIT 5
    

    Will fetch the latest 5 updated tasks from the database with the given task_id. Remove the WHERE clause to get the newest tasks regardless of the task_id.

    note: the TIMESTAMP data type is special, in the sense that MySQL will update the field automatically, by default, to the current timestamp, unless a value is explicitly defined in the insert or update query. If this behavior is not wanted, use DATETIME, but it will require that you specify the column value for the new column (unless a default value is set in the table)

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

Sidebar

Related Questions

I want to retrieve all records from one table when there are no matches
I am using datatable to retrieve 1000 records from mysql database. I want to
I want to retrieve a set of records from a database, do a rs.next()
I want to retrieve records from DB2 and display the records in DataGridView in
I want to retrieve the records from a table without its associations mentioned in
I want to paginate two database tables having same structure(eg SMS and MMS) which
I have to retrieve the more than 100 records from the Database table using
What I want to do is retrieve all emails from MS SQL Customer table
I am new to SQL and relational DBMS. I want to retrieve records from
I want to retrieve the most recently added record from CoreData. I was wondering

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.