How to find last updated record in the MYSQL database.? this problem comes from manual entry
Asked
Active
Viewed 176 times
1
-
Can you give us more information? – Lajos Arpad Oct 29 '13 at 06:05
-
1Check this link http://stackoverflow.com/questions/307438/how-can-i-tell-when-a-mysql-table-was-last-updated – vijaykumar Oct 29 '13 at 06:07
1 Answers
0
Probably the best solution is to add a column for when the last update occurred. You can manually update that field, create a stored procedure or trigger to automatically update it, or rely on MySQL do to so. The first TIMESTAMP field of a table will be updated to the current time when updating the row. Looking at vijay4vijju's link, the poster Bill Karwin suggests something similar.
Then, to answer the question in your subject, you would run an SQL query such as
SELECT id, updated
FROM foo
WHERE updated >= NOW() - INTERVAL 1 HOUR
ORDER BY updated DESC

Isaac Bennetch
- 11,830
- 2
- 32
- 43