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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 18, 20262026-06-18T05:05:23+00:00 2026-06-18T05:05:23+00:00

I am trying to select a row order by added_date or if row is

  • 0

I am trying to select a row order by added_date or if row is updated then order by updated_date.

Default the updated date is Null.

For the above table date given in (dd-mm-yy).

For the below table the first row is added at 2 feb and second is added at 1 feb so by using ,

select * from tablename order by added_date desc;

I get the latest row, but if any row is updated then this updated row becomes latest row.

For second row, row added at 1st feb but it’s updated at 3rd feb so its becomes latest row.

How can I get the record with added and updated date ??

    id   title    name   added_date   updated_date
     1   asd      rff     02-02-2013    NULL
     2   fsfs     rwr     01-02-2013    03-02-2012
     3   ddd      wwrr    30-01-2013    04-02-2013

Edit:using MYSQL

  • 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-18T05:05:23+00:00Added an answer on June 18, 2026 at 5:05 am

    You didn’t specify which RDBMS you use. For Oracle you can try this:

    SELECT * FROM tablename ORDER BY NVL(updated_date,added_date) DESC;
    

    SQL Server:

    SELECT * FROM tablename ORDER BY ISNULL(updated_date,added_date) DESC
    

    MySQL:

    select * from tablename order by ifnull(updated_date,added_date) desc;
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm trying to select rows from a table, one row per email address, and
im trying to select the row quote and author from my table and echo
I m trying to select rows/columns using vba. I want to pass row numbers
I am trying to select the last record from a table in MySQL using
I have a MySQL table that's being updated very frequently. In essence, I'm trying
I'm trying to select next row from current id. How can i find out
I'm trying to select only one row from each portal (the last one by
I have a table with a row of 3 div's then another row or
I'm trying to write a query in php that will select a row from
I am trying to use all columns for each row from one table (party),

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.