Hi,
If I have 10 rows of information with ID’s from 1 to 10 (with 10 being the most recent data) I know I could write a MYSQL statement which says
SELECT… WHERE ID=6,7,8,9,10
to get the most recent info only.
Is there a way to do this that does not require constant updating?
I just want the information from the rows of the 5 most recent data entries (so when I add row with ID 11 I just want WHERE ID= 7,8,9,10,11
Thanks.
SamA74
2
Something like this:-
"SELECT columns FROM table ORDER BY id DESC LIMIT 5"
We order by ID descending to get the highest ID numbers first, then limit the query to select only 5 rows. You should get the last 5 entries.
I see - Yes - That would work - I’ll do that, thanks.
system
Closed
4
This topic was automatically closed 91 days after the last reply. New replies are no longer allowed.