How do I find records added to my database table in the past 24 hours?,
I’m using MySQL in particular, but I’m hoping for a cross-vendor solution. I’m using the NOW() function to add a timestamp as a column for each record.
INSERT INTO messages (typeId, messageTime, stationId, message) VALUES (?, NOW(), ?, ?)
SELECT * FROM messages WHERE DATE_SUB(CURDATE(),INTERVAL 1 DAY) <= messageTime
That's the answer How do I find records added to my database table in the past 24 hours?, Hope this helps those looking for an answer. Then we suggest to do a search for the next question and find the answer only on our site.
The answers provided above are only to be used to guide the learning process. The questions above are open-ended questions, meaning that many answers are not fixed as above. I hope this article can be useful, Thank you