SQL query for selecting most recent entries
Posted
by
Mr_Skid_Marks
on Stack Overflow
See other posts from Stack Overflow
or by Mr_Skid_Marks
Published on 2014-08-23T04:17:19Z
Indexed on
2014/08/23
4:20 UTC
Read the original article
Hit count: 100
A table in my database has a column, DATE_ADDED (stored in seconds). I want to extract all rows with the most recent date (aka largest value for DATE_ADDED).
The only solution I have come up with is to SELECT all the rows in ASC (ascending) order, grab the last entry from the table, check the date on this, and perform another SELECT on the table but this time only for the discovered DATE_ADDED.
Is it possibly to simplify this series of queries into a single one? My thought is I should be able to do a SELECT on all of the largest values in the table, but I am struggling to come up with a proper query.
© Stack Overflow or respective owner