vinay_forum Posted October 12, 2009 Share Posted October 12, 2009 I need to fetch the last 24 hours record from my table. Need help on this.. Thanks. Link to comment https://forums.phpfreaks.com/topic/177411-fetching-last-24-hours-records-from-db/ Share on other sites More sharing options...
kickstart Posted October 12, 2009 Share Posted October 12, 2009 Hi Do you have a date field on the table? What is the structure of the table? All the best Keith Link to comment https://forums.phpfreaks.com/topic/177411-fetching-last-24-hours-records-from-db/#findComment-935444 Share on other sites More sharing options...
xsist10 Posted October 12, 2009 Share Posted October 12, 2009 Are you storing a datetime field or a timestamp field? If so you can select on that. SELECT [fields] FROM [table] WHERE [datetime_field] > NOW() - INTERVAL 24 HOUR ORDER BY [datetime_field]; If not then you're out of luck. You could potentially look at your bin logs but it would be much easier to just add a field. Link to comment https://forums.phpfreaks.com/topic/177411-fetching-last-24-hours-records-from-db/#findComment-935453 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.