1

How to find last updated record in the MYSQL database.? this problem comes from manual entry

Boopathi Rajan
  • 1,212
  • 15
  • 38

1 Answers1

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